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
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Sebastien VinchonSubject: In need for help on converting record oriented flat file to XML
Author: Sebastien Vinchon
Date: 15 Jun 2009 11:36 AM
Hello,

I am in need for an advice on how to tell Stylus Studio Flat File to XML conversion engine to process differently lines depending on the value at a specific position.

As an example, when processing the attached file, I want to create a complex node called:
- L1 when the four character starting at position 85 are equal to 0012
- L2 when the four character starting at position 85 are equal to 0022
- L3 when the four character starting at position 85 are different from 0012 and 0013

Many thanks for any help.

Sebastien


UnknownMECHETOK.multi.dat

Postnext
Sebastien VinchonSubject: In need for help on converting record oriented flat file to XML
Author: Sebastien Vinchon
Date: 15 Jun 2009 01:16 PM
Here are how my CONV and xQuery currently look like.


UnknownMECHETOK_Flux.dat.1.conv


UnknownMECHETOK_Flux.dat.1.conv.xquery

Posttop
Tony LavinioSubject: In need for help on converting record oriented flat file to XML
Author: Tony Lavinio
Date: 03 Aug 2009 11:30 PM
What you want to do is create a separate record layout
for each type. To do this, we use what we call "patterns".

Load the file into Custom XML Converters, and do this:

Right-click on the line that will become L1 and choose
"Add node/pattern". For the name, use L1, and for the
pattern use the regular expression ^.{85}0012

Now do similar for L2 with ^.{85}0022

Now, look at the schema tree on the right. It will have several
branches. Go to the one without a pattern showing, and select
the row name and press F2 to rename, and put in L3.

What the .^{85}0012 etc. means is:
^ start matching from the start of the string
.{85} match 85 occurrences of any character
0012 match the string "0012"

You can find more on "regular expressions" by Googling.

Now, with the different record layouts, you can break things
into different fields for each one independently.

 
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.