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
peter cameronSubject: splitting a row into multiple into multiple fields to convert to xml
Author: peter cameron
Date: 07 Jun 2011 08:58 AM
Hello,

I have imported a customer source file and am creating a conv file to convert to xml.The source file that is basically text, an example below has 3 rows. Row A is one Row(table) in xml and the 2 rows starting with B are the second XML row(table) in the xml. The data in the B rows repeat a number of times within the rows as well as seperate rows. I can pattern match the rows by ^B at the beginning. The issue i have is to map the fields within a row, i need to split up the data within a row.

A999ABC777
B123EEE123CC22POI666ABC789LL33XDR
B223CBA321BB12XOI789ZZZ927MWQ2BAT

This is the result i am looking for:

<ROOT>
<TABLE_A>
<TABLE_REF>A</TABLE_REF>
<REF>999</REF>
<NAME>ABC</NAME>
<ID>777</ID>
</TABLE_A>
<TABLE_B>
<TABLE_REF>B</TABLE_REF>
<CUST_NO>123</CUST_NO>
<ADDR>EEE</ADDR>
<APP_NO>123</APP_NO>
<CONTACT>CC22POI</CONTACT>
</TABLE_B>
<TABLE_B>
<TABLE_REF>B</TABLE_REF>
<CUST_NO>666</CUST_NO>
<ADDR>ABC</ADDR>
<APP_NO>789</APP_NO>
<CONTACT>LL33XDR</CONTACT>
</TABLE_B>
<TABLE_B>
<TABLE_REF>B</TABLE_REF>
<CUST_NO>223</CUST_NO>
<ADDR>CBA</ADDR>
<APP_NO>321</APP_NO>
<CONTACT>BB12XOI</CONTACT>
</TABLE_B>
<TABLE_B>
<TABLE_REF>B</TABLE_REF>
<CUST_NO>789</CUST_NO>
<ADDR>ZZZ</ADDR>
<APP_NO>927</APP_NO>
<CONTACT>MWQ2BAT
</CONTACT>
</TABLE_B>

Postnext
Ivan PedruzziSubject: splitting a row into multiple into multiple fields to convert to xml
Author: Ivan Pedruzzi
Date: 08 Jun 2011 12:00 AM

If these records are based on fixed layout you can mix pattern matching with fixed layout region; have a look at the online documentation -> Adjusting Fixed-Width Regions.




Posttop
peter cameronSubject: splitting a row into multiple into multiple fields to convert to xml
Author: peter cameron
Date: 08 Jun 2011 06:04 AM
thanks for reply. Having a little difficulty trying to apply what you have said. the first customer row (example A above) will be fixed, however the B row will have a maximum width but we don;t know how many records will be in the next B rows, so the maximum number of records in the first B row will be say 10, then if we have another 2 B rows the second one will contain 10 records and the 3rd we don't know could be anything from 1 to 10 records. However the records in each row do follow a pattern like my example i.e.

can you help me a litte more with the solution to my challange?

thanks

 
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.