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
steven nourseSubject: Running xquery with a source conversion from command line
Author: steven nourse
Date: 04 Aug 2008 12:07 PM
I am trying to run an xquery from the command line and I need the source document converted from a csv to an xml. How do I do this?

Here is the command I am using that does not work.
This is the main part I am wondering about

-s converter:CSV?file:///C:/MA540CSV.20080708 -o output.xml

Whole cmd
java -cp "c:\Program Files\Stylus Studio 2008 XML Enterprise Suite Release 2\Components\DataDirect XQuery\lib\ddxq.jar";"c:\Program Files\Stylus Studio 2008 XML Enterprise Suite Release 2\Components\XML Converters for Java\lib\XMLConverters.jar";"c:/PROGRA~1/STYLUS~1/Components/XML Converters for Java/lib/codehaus/wstx-asl.jar" com.ddtek.xquery.Query -s converter:CSV?file:///C:/MA540CSV.20080708 -o output.xml MA540to810.xquery

Postnext
Minollo I.Subject: Running xquery with a source conversion from command line
Author: Minollo I.
Date: 04 Aug 2008 12:42 PM
You won't be able to use the -s argument to specify an XML converters URI (even if that's a very good topic for an enhancement request in the command line utlity).

You can achieve a similar result using declaring an external variable in your XQuery...

declare variable $input as xs:string external;

...and then using the fn:doc() function to navigate the content of the input file; so, instead of ...
/table/...
...you would do...
fn:doc($input)/table/...

Then your cmdline can become:
java -cp "c:\Program Files\Stylus Studio 2008 XML Enterprise Suite Release 2\Components\DataDirect XQuery\lib\ddxq.jar";"c:\Program Files\Stylus Studio 2008 XML Enterprise Suite Release 2\Components\XML Converters for Java\lib\XMLConverters.jar";"c:/PROGRA~1/STYLUS~1/Components/XML Converters for Java/lib/codehaus/wstx-asl.jar" com.ddtek.xquery.Query -o output.xml MA540to810.xquery input="converter:CSV?file:///C:/MA540CSV.20080708"

Postnext
steven nourseSubject: Running xquery with a source conversion from command line
Author: steven nourse
Date: 04 Aug 2008 01:45 PM
Would it be better to just generate java code for this purpose and then run the java program from the command line?

Do you need additional licenses to run stylus studio xquery stuff through a java program?

Posttop
Minollo I.Subject: Running xquery with a source conversion from command line
Author: Minollo I.
Date: 04 Aug 2008 01:57 PM
Originally Posted: 04 Aug 2008 01:56 PM
>Would it be better to just generate java code for this purpose and
>then run the java program from the command line?

You wouldn't need to create the external variable in that case. Apart from that, you shouldn't see significant differences.

>Do you need additional licenses to run stylus studio xquery stuff
>through a java program?

Same as running the command line; you'll need runtime DataDirect XQuery and XML Converters licenses consistent with your deployment model.

 
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.