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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
- Stylus Studio Technical Forum (14621)
-> - Stylus Studio - Registrar en o... (1)
-> + Stylus Studio - Registrar en o... (2)
-> + Can a pipeline send a file by ... (2)
-> + After Updateing WIN10 to WIN11... (12)
-> + Where do I add the custom java... (3)
-> + Where is the Diagram tab? (5)
-> + Applying XSLT to Word DOCX/XML (2)
-> - CSV conversion via ConvertToXM... (1)
-> + Text symbols in SS not same as... (4)
-> + Exposing xquery as webservice ... (6)
-> + Syntax Identifier (2)
-> + Saving a Converted XML as an X... (5)
-> + Output document cannot be pars... (4)
-> - Archiving output from conversi... (1)
-> + EDIFACT guideline from Stylus ... (3)
-> + CSV file putting all the data ... (5)
-> + Can't install Home version 64b... (5)
-> + presale - Can I covers this sc... (5)
-> + Problem with UNB (5)
-> + Splitting EDIFACT files pipeli... (4)
-- [1-20] [21-40] [41-60] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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

   
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.