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)
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
- XQuery Help and Discussion (2017)
-> + Issue with Processing Instruct... (2)
-> + problem converting json to XML... (2)
-> + Problem base64 decoding string... (3)
-> + Problems posting multipart for... (5)
-> + trouble with download of price... (2)
-> + Problem with http-post not bei... (3)
-> + path problem, xps_file:writeAl... (9)
-> + Xquery update support? (2)
-> + problem with Stylus studio try... (5)
-> + adding dtd reference to xml ou... (4)
-> + xquery escaping ambarsand when... (3)
-> + Whitespace problem when return... (5)
-> + Problem with namespace prefix ... (5)
-> - Sending via SFTP returns unexp... (1)
-> + Query and Sftp clent (4)
-> + xquery and try - catch (3)
-> + Query + ddtek:http-post optio... (5)
-> + Example files referenced in do... (3)
-> + Automatic Error Detection and ... (3)
-> + Working with result of ddtek:h... (2)
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Phillip AnkersonSubject: convert text to xml from more than one source?
Author: Phillip Ankerson
Date: 21 Aug 2008 12:12 PM
I have watched the video tutorial on how to create a customer xml converter for a text file, and have done that with a relatively simple text file. I need to read from more than one source (perhaps two text files - one for customers and one for addresses) or a database file, and create and xml file according to a spec I was given. Is this something that must be done with XQuery, or can it be done at all? We are creating an interface with Websphere...is there a pre-defined connector for this?

Example:
source 1 - customer
name1,status,logonID1,companyName
name2,status,logonID2,companyName
name3,status,logonID3,companyName

source 2 - address
addresstype,zipcode,phone1,email1,firstName,LastName,address1,city,state
addresstype,zipcode,phone1,email1,firstName,LastName,address1,city,state
addresstype,zipcode,phone1,email2,firstName,LastName,address1,city,state
addresstype,zipcode,phone1,email3,firstName,LastName,address1,city,state

logonId = email; notice there could be more than one address per user


Posttop
Minollo I.Subject: convert text to xml from more than one source?
Author: Minollo I.
Date: 21 Aug 2008 12:47 PM
You can do that with XQuery, yes; joining data across multiple XML and/or non-XML files and/or database tables. In your case, something similar to this (using the built-in CSV converter; if the format is CSV, you don't need to create a custom one):
<root> {
for $row1 in doc("converter:CSV?c:/file1.csv")//row,
$row2 in doc("converter:CSV?c:/file2.csv")//row
where $row1/column.2 = $row2/column.3
return
<data>
<somedata>{$row1/column.0/text()}</somedata>
<moredata>{$row2/column.0/text()}</moredata>
</data>
} </root>

If the first row of the CSV contains "field names", then it's even easier, and you can get better element names in the output using "converter:CSV:first=yes?...". If you want to share some real example, we can create a sample XQuery for you.

You can integrate DataDirect XQuery/XML Converters in any Java application; so, you can surely integrate that in your WebSphere application. We do have an XQuery based servlet implementation (with sources available) that can expose virtually any XQuery as a Web service without any additional code; and it's compatible with WebSphere (see http://www.xquery.com/examples/web-service-example/xquerywebservice/).

   
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.