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
Larry JohnsonSubject: Text to XML conversion issue
Author: Larry Johnson
Date: 03 Dec 2008 02:20 PM
I'm fairly new to using the .conv files. First let me say thanks for the tutorial videos... they are very helpful. I have a situation that I'm not sure how to handle, though. I have an input file that contains legacy mainframe data. Each line can be no longer than 80 characters. Since that isn't enough room to represent some information, it has a structure similar to the following:

120 01 Field1 Field2 Field3
120 03 Field4 AnotherField YetAnotherField
122 01 Field1 Field2
122 02 Field3 Field4 Field5
122 03 Field6 Field7

The first number (120, 122) is the record type. The second number is a sub-type which tells me what information is in that row. So, even though it took two rows to represent a 120 record in my example, it is one logical record and I want it to be a single <Record120> element in my output.

Now for the harder part, the 122 records are detail records that belong to the 120 record. Each 120 record can have multiple 122 records. I would like the 122 records to be children of their respective 120 elements in my output. So, I would like my XML to be formatted something like this:

<Record120>
<Field1>...</Field1>
<Field2>...</Field2>
<Record122>
<Field1>...</Field2>
.
.
<Field7>...</Field7>
</Record122>
<Record122>
<Field1>..</Field1>
.
.
</Record122>
</Record120>

</Record120>

I haven't been able to figure out how define the node much less how to output it in a hierarchical manner. Can anyone point me in the right direction?

Posttop
Tony LavinioSubject: Text to XML conversion issue
Author: Tony Lavinio
Date: 03 Dec 2008 05:47 PM
The Custom XML Converter module's job is to get the data into
XML. The job of formatting the XML into a shape that is specifically
useful for a given case is left to XSLT or XQuery, which were
designed specifically for transforming XML.

You can use the output of the CXC as input to XSLT by specifying
the filename like this for the XSLT:

converter:file:///c:/myconvfile.conv?file:///c:/myinputfile.txt

XSLT 2.0 has excellent features for grouping data; Jeni Tennison
has some pointers for doing grouping if you are using XSLT 1.0 on
her web site http://www.jenitennison.com/

 
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.