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 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
gavin clarkSubject: convert flat file to XML - creating child/sibling relationships ?
Author: gavin clark
Date: 22 Sep 2005 09:26 AM
Hi,

I have a flat file (of invoice data) which contains rows of records, there's structure to the file with record type labels i.e.

[file header]
[invoice header]
[invoice line]
[invoice line]
[invoice trailer]
[invoice header]
[invoice line]
[invoice trailer]
.
.
[file trailer]

the fact that an [invoice line] repeats 1 or many times within an [invoice header] is implied, as is the fact that there may be 1 or more [invoice header]/[invoice trailer] records within the whole file.

I can convert row for row very easily, but this isn't really what I want!. How do I tell StylusStudio that the [invoice line] record is a child of the [invoice header] record ?, is this possible in Stylus Studio ?.

I don't have a target XML for this raw data, but I do for my final Invoice and I thought the process would be convert to xml -> xslt mapping -> output finished xml but it's the convert to xml which is causing me the problems ....

thanks in advance

Gavin


Unknownbex_lilly_invoice_data(1).txt
source flat file data

Unknowntest_lilly002.conv
convert to xml adaptor

Postnext
Tony LavinioSubject: convert flat file to XML - creating child/sibling relationships ?
Author: Tony Lavinio
Date: 26 Sep 2005 03:31 PM
Originally Posted: 26 Sep 2005 03:30 PM
I did a Google on "convert flat xml to hierarchical xml with xslt" to find a simple solution. I hacked it up a bit to reflect your incoming data stream, and I've attached it.


Documentbex.xsl
convert flat xml to hierarchical xml

Postnext
gavin clarkSubject: convert flat file to XML - creating child/sibling relationships ?
Author: gavin clark
Date: 27 Sep 2005 04:38 AM
Tony,

thanks for the help, I'd hoped it was something that Stylus Studio could do (I'm surprised you've not come across this kind of problem before). How does it handle multiple line EDI orders - from what I can remember of EDIFACT the basic structure of my file is very similar.

I'll admit to being a little disappointed that Stylus Studio can't do this kind of mapping.

thanks again

Gavin

Posttop
Tony LavinioSubject: convert flat file to XML - creating child/sibling relationships ?
Author: Tony Lavinio
Date: 27 Sep 2005 08:54 AM
For EDIFACT we have a built-in adapter which does this natively.
It recognizes ALL of the releases from 93A to 04B, and handles
both V3 and V4 syntax. It's bi-directional, and even generates
comments in the XML for debugging purposes so you can understand,
for example, what RFF01 is supposed to be.

As far as multi-level output from C2XML, we've talked about this,
but we think that adding that also makes the tool unwieldly. We'd
rather see XSLT or XQuery, which are excellent for transforming
data, used for manipulation, and C2XML for conversion. Otherwise,
we're adding yet another thing to learn, and another level of
complexity, to the conversion step.

But we'll keep revisiting the idea, and maybe a simple solution
that satisfies the 80/20 rule will appear.

 
Topic Page 1 2 3 4 5 6 7 8 9 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.