Subject:Running xquery from the command line Author:steven nourse Date:30 Jul 2008 03:38 PM
I am trying to run an xquery from the command line and I am getting this error message:
Error (file (null), line 0, column 0): External function 'increment' has not bee
n bound to an implementation
increment is an external java function that I have created and it runs fine within stylus studio. Any help is appreciated.
Subject:Running xquery from the command line Author:steven nourse Date:30 Jul 2008 03:53 PM
Command line:
C:\Documents and Settings\snourse\My Documents\Work\Stylus Studio>"C:\Program Fi
les\Stylus Studio 2008 XML Enterprise Suite Release 2\bin\StylusXql" -in CMS_sam
ple.xml -out converter:EDI?output.edi xml_to_837.xquery
in file:
declare namespace Counter = "ddtekjava:Counter";
declare function Counter:increment() as xs:double external;
declare function Counter:previous() as xs:double external;
Subject:Running xquery from the command line Author:Minollo I. Date:30 Jul 2008 04:21 PM Originally Posted: 30 Jul 2008 04:11 PM
Oh, that explains it; StylusXql invokes the Stylus Studio XQuery engine, which is a simpler C++ based XQuery engine used by Stylus Studio mostly for debugging purposes.
Your XQuery is relying on DataDirect XQuery, and that's what you want to run.
To do that, you can execute:
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" com.ddtek.xquery.Query -s CMS_sample.xml -o output.edi xml_to_837.xquery !method=EDI
Subject:Running xquery from the command line Author:steven nourse Date:30 Jul 2008 04:37 PM
Thank you I have got it working. I just had to also add the classpath to my custom java function in and it worked perfectly. Just for reference for anyone else this is the full command that I used.
java -cp "c:\P
rogram Files\Stylus Studio 2008 XML Enterprise Suite Release 2\Components\DataDi
rect XQuery\lib\ddxq.jar";"c:\Program Files\Stylus Studio 2008 XML Enterprise Su
ite Release 2\Components\XML Converters for Java\lib\XMLConverters.jar";"C:\Docu
ments and Settings\snourse\My Documents\Work\Stylus Studio" com.ddtek.xquery.Que
ry -s CMS_sample.xml -o output.edi xml_to_837.xquery !method=EDI
Subject:Running xquery from the command line Author:Minollo I. Date:30 Jul 2008 05:28 PM
For the record, and so that you are not surprised when that happens: you can use DataDirect XQuery and XML Converters outside the Stylus Studio UI (like through the command line interface) only if you have a valid license for those components.
You'll be able to run the command above for 14 days after the Stylus Studio installation day; after that period, you'll need to contact our sales or support organization at DataDirect (www.datadirect.com) for details about what additional licenses you would need and/or to extend your evaluation period for the components.