Bug #4353
closedExtra namespaces present when serializing XdmValue using Serializer API
0%
Description
I have an "net.sf.saxon.s9api.XdmValue" which resulted from an XQuery update operation. I create a serializer "net.sf.saxon.s9api.Processor.newSerializer(Writer)" and then use it to serialize the value:
serializer.serializeXdmValue(rootElement);
Problem is that with Saxon 9.9 I get extra not-necessary namespaces serialized, something like:
<p:url href="http://www.example.com" xmlns:p="http://www.oxygenxml.com/ns/samples/personal"/>
so I would prefer somehow to have an extra namespace reducer when writing the content.
I looked at the implementation of "net.sf.saxon.s9api.Processor.writeXdmValue(XdmValue, Destination)" which seems to be adding a namespace reducer on the "else" clause so I used the following workaround on my side:
processor.writeXdmValue(rootElement, new AbstractDestination() {
@Override
public Receiver getReceiver(PipelineConfiguration pipe, SerializationProperties params)
throws SaxonApiException {
return serializer.getReceiver(pipe, params);
}
@Override
public void close() throws SaxonApiException {
serializer.close();
}
});
to force the code on the "else" branch and add that extra namespace reducer. But maybe "serializer.serializeXdmValue(rootElement);" could by default somehow use an namespace reducer by default.
Please register to edit this issue