Bug #3708
closedSerialization options ignored for XQuery update from command line
100%
Description
From direct email:
I have a XQuery which modifies the content of /text/a and reserves CDATA in /test/pattern of a XML file.
xquery version "3.0";
declare namespace saxon = "http://saxon.sf.net/";
declare option saxon:output "cdata-section-elements=pattern";
let $doc := doc('testCDATA.xml')
return replace value of node $doc/test/a with 'fromxquery'
The XML file testCDATA.xml :
<test>
<a>test</a>
<pattern><![CDATA[(?<=(^|[^0-9]+))([0-9]+([-]+[0-9]+)*)(?=([^0-9]+|$))]]></pattern>
</test>
It works well in oXygen 19.1 with Saxon-EE 9.7.0.19
But if I run it with the Saxon (Saxon-EE 9.8.0.6J) command:
java -cp saxon9ee.jar net.sf.saxon.Query -t -backup:off -update:on -q:testCDATA.xquery
"CDATA" is get rid of the XML. It seems that options of serialization are not taken in Saxon for an update of the same file. If I missed something or it's a problem of Saxon?
Updated by Michael Kay about 6 years ago
- Status changed from New to In Progress
Confirmed that the problem exists.
Note that you can work around the problem by supplying serialization parameters on the command line, e.g.
!cdata-section-elements=pattern
Updated by Michael Kay about 6 years ago
- Status changed from In Progress to Resolved
- Applies to branch 9.8, trunk added
- Fix Committed on Branch 9.8, trunk added
Resolved in net.sf.saxon.Query by initializing the Serializer from the query properties:
if (updating && exp.isUpdateQuery()) {
serializer.setDefaultOutputProperties(
exp.getUnderlyingCompiledQuery().getExecutable().getDefaultOutputProperties());
runUpdate(exp, evaluator, serializer);
Note that this is specific to command-line invocation. At the API level, XQuery makes the updated documents available to the application, which can serialize them (and/or write them as files to filestore) if it wishes to do so.
Updated by O'Neil Delpratt about 6 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.10 added
Bug fix applied in the Saxon 9.8.0.10 maintenance release.
Please register to edit this issue