XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Michael LangeSubject: Complex Flat File to XML Conversion
Author: Michael Lange
Date: 25 Jul 2006 12:22 PM
I am evaluating your flat file to XML conversion capabilities.

I have a specific file format I am trying to convert and it is not clear to me how it would be done with your tool or even if it can be done. The file format has a header section followed by repeating record format consisting of one row of meta data followed by 7 rows or data values (the 8 row pattern repeats over and over after the header).

The 5th line in the header has the column names for the data value fields.

Here is a sample section from an file:
* PROCESS LINE DATE 02:39 13 Jun 2003 WAFER 031040506 OPER:drf
* INPUT PROBE SN 42461 OUTPUT PROBE SN 42464 OTHER PROBE SN NONE RFLAB1
* ET=Elapsed Time (min), Key = Bias
* EG1245 PROD Power START SITE 1 STOP SITE 301
* FREQ PIN_0 POUT_0 GAIN PAE IG_DRIVE ID_DRIVE
* GHZ DBM DBM DB % Amps Amps
*R 3 C 9 KEY A ET 02:40:38 V3= +9.500000E+00 I3= 1.067141 V1= -9.100000E-01 I1= -3.685418E-06
8.000000 27.000000 40.690000 13.690000 32.918447 -0.001133 3.587679
8.500000 27.000000 40.575000 13.575000 31.420876 -0.001123 3.656104
9.000000 27.000000 40.415000 13.415000 31.103658 -0.001154 3.553782
9.500000 27.000000 40.195001 13.195001 31.429457 -0.001157 3.334857
10.000000 27.000000 39.904999 12.904999 31.195521 -0.001203 3.131556
10.500000 27.000000 40.030001 13.030001 29.987248 -0.000823 3.357911
11.000000 27.000000 40.159999 13.159999 28.202235 -0.000355 3.685298
*R 3 C 9 KEY B ET 02:41:02 V3= +9.000000E+00 I3= 1.066677 V1= -9.000000E-01 I1= -2.900078E-06
8.000000 22.000000 39.820000 17.820000 36.824601 -0.000760 2.847117
8.500000 22.000000 40.185000 18.185000 35.982612 -0.001357 3.173971
9.000000 22.000000 40.065000 18.065000 36.552389 -0.001282 3.037019
9.500000 22.000000 39.845001 17.845001 37.651943 -0.001284 2.800189
10.000000 22.000000 39.504999 17.504999 37.086576 -0.001205 2.625437
10.500000 22.000000 39.630001 17.630001 38.391191 -0.000832 2.611970
11.000000 22.000000 39.779999 17.779999 37.931561 -0.000626 2.738634

The rows starting with "*R" are the first rows of the repeating section.

I want to create an adapter to automaticaly convert these types of files to XML. Is that possible? If so, can you point me in the right direction in terms of handling the 8 row repeating format? Also, once an adapter is created, can I run it from the command line (Windows) so that I can create a batch file to convert hundreds of files overnight?

Thanks,
Mike

Postnext
Tony LavinioSubject: Complex Flat File to XML Conversion
Author: Tony Lavinio
Date: 26 Jul 2006 03:23 AM
I took your sample data and made a lange.txt file, which is attached,
and created a lange.conv file, which is the file our Convert-to-XML
uses as a map.

Since I don't really understand the details, I made a few guesses.
Please ignore the field named "THINGY" ;).

This will allow you to load the data and convert it to XML. The next
step would most likely be to use this as input to XSLT or XQuery to do
whatever grouping or reporting you need.

And yes, this can be run from the command line, or embedded in code.
See http://www.stylusstudio.com/deployment/


Unknownlange.txt


Unknownlange.conv

Postnext
Michael LangeSubject: Complex Flat File to XML Conversion
Author: Michael Lange
Date: 26 Jul 2006 11:00 AM
Tony,

This sounds very encouraging however I could not access the lange.conv file. I get a File Not Found error. I could access lange.txt without a problem.

Is the file posted correctly?

Thanks,
Mike

Postnext
Tony LavinioSubject: Complex Flat File to XML Conversion
Author: Tony Lavinio
Date: 26 Jul 2006 03:54 PM
Sorry 'bout that. We recently upgraded our server, and the new one
evidently didn't like .conv files. Fixed.

Postnext
Michael LangeSubject: Complex Flat File to XML Conversion
Author: Michael Lange
Date: 26 Jul 2006 04:20 PM
Got the file and was able to use it to convert a larger file to XML.

I have to admit I don't totally understand it yet. I see how the "r" section in the body knows to get only the rows that start with "*r" but I don't see how the "data" section knows to get all of the rows that do not start with "*r". How is that working?

If we can get this to do what we want I am quite sure we will be purchasing the product.

Thanks for you help,
Mike

Postnext
Tony LavinioSubject: Complex Flat File to XML Conversion
Author: Tony Lavinio
Date: 27 Jul 2006 09:24 AM
In each region, if you have a pattern which has a blank regular
expression, it is the 'default' case that is used if no other
pattern matches.

Postnext
Michael LangeSubject: Complex Flat File to XML Conversion
Author: Michael Lange
Date: 27 Jul 2006 09:49 AM
Thank you. That is what I was guessing but it seemed a little counter-intuitive. For whatever reason my brain was telling me that a bank pattern should match everything.

Thanks for your help.
Mike

Postnext
Michael LangeSubject: Complex Flat File to XML Conversion
Author: Michael Lange
Date: 10 Aug 2006 02:23 PM
Tony,

I am back to evaluating this tool for Northrop Grumman (and running out of evaluation time). I am trying to convert the attached file (sample.txt) to xml. This is similar to the one you helped me with previously but a little more complicated.

In the repeating region, there are some lines that are tab delimited and some that are space delimited (the lines starting with "*R" vs. the lines with numeric data). How would you handle this?

Thanks,
Mike


Documentsample(1).txt
sample text file to parse

Documentsample.conv
start of a conv file

Postnext
Tony LavinioSubject: Complex Flat File to XML Conversion
Author: Tony Lavinio
Date: 17 Aug 2006 09:17 AM
Sorry for the delay in getting back. If your eval time is running
out, you (in this special case) may send an email to
StylusStudio@StylusStudio.com asking for an extension, and referring
to this message from me.

There are a couple of options.

1. We support 'subcomponents'. If you set the subcomponent
character to ' ' (that's a space), then you can break apart
those lines. The disadvantage is that the fields won't get
nice happy separate names in the *R lines. You'll need to
refer to them as row/component[1], ...[2], etc. But if you
are massaging the output of C2XML with XSLT, that's not too
much of a problem.

2. We are continuously refining C2XML as we discover new needs;
perhaps we could work with you specifically on this and other
test cases.

Posttop
Michael LangeSubject: Complex Flat File to XML Conversion
Author: Michael Lange
Date: 17 Aug 2006 10:55 AM
Tony,

Thanks for getting back to me. At least for now I got around this problem be pre-processing the file to convert all spaces to tabs. I did this with an editor for my test case but I am thinking I can do it with SED when I have to do hundreds of files at once.

I am not up-to-speed on XSLT yet but I am thinking I need to start learning about it.

Let me ask you this. If we wanted you guys to provide a converter and XSLT translation for us for specific needs could we hire you guys to do that? We would provide an input flat file format and a desired XML output format. You would intern provide us everything we need so that we can batch process hundreds of these files from a command line.

Please let me know if this would be an option and, if so, how it would be charged--or who I should talk to for further details.

Thanks for you input.

-Mike

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.