2

Did anyone get successful to use this command line sample? with a hardcoded json string as below command from this link posted by Michael Kay (founder of Saxonica):

java -cp Saxon-HE-9.7.0-18.jar net.sf.saxon.Query -t -qs:"json-to-xml('{\"x\":1}')" -o:output:some.xml

I continuously got follow error with even PE/EE:

  • Saxon-HE 9.7.0.18J from Saxonica
  • Java version 1.7.0_79 Analyzing query from {json-to-xml('{"x":1}')}
  • Static error on line 1 at column 1 in {json-to-xml('{"x":1}')}
  • XPST0017: System function json-to-xml#1 is not available with this host-language/version/license Static error(s) in query

Can anyone help?

Daniel Haley
  • 51,389
  • 6
  • 69
  • 95

1 Answers1

2

I was able to successfully use the example by specifying the version "3.1" (-qversion:3.1) on the command line:

C:\Windows\System32>java -cp "C:/apps/saxon/saxon9he.jar" net.sf.saxon.Query -t -qversion:3.1 -qs:"json-to-xml('{\"x\":1}')"
Saxon-HE 9.7.0.8J from Saxonica
Java version 1.8.0_60
Analyzing query from {json-to-xml('{"x":1}')}
Analysis time: 117.919941 milliseconds
<?xml version="1.0" encoding="UTF-8"?><map xmlns="http://www.w3.org/2005/xpath-functions"><number key="x">1</number></map>
Execution time: 40.174138ms
Memory used: 29834272
Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
  • Thanks Daniel! that's the tricky. Not sure why this is not documented in their website. – Michael Sun May 22 '17 at 21:36
  • my bad; since I am doing a quick POC, I did not go over the document thoroughly so that I missed so important info in the document; – Michael Sun May 25 '17 at 21:43
  • @MichaelSun - It's no problem. Glad I could help. I'd still appreciate you accepting the answer by clicking on the check mark (✅) next to it. :-) – Daniel Haley May 25 '17 at 23:09