Bug #5788
closed
XdmNode.toString() is no longer indented
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Description
Issue reported by user here: https://saxonica.plan.io/boards/4/topics/9166
The default toString() of an XdmNode with SaxonJ and SaxonCS seems to use indentation while that doesn't happen for SaxonC.
See repo below:
from saxonc import *
with PySaxonProcessor(license=False) as proc:
doc_builder = proc.new_document_builder()
xml2 = '''<root><item>a</item><item>b</item><item>c</item></root>'''
xdm_node2 = doc_builder.parse_xml(xml_text = xml2)
print(xdm_node2)
- Assignee changed from O'Neil Delpratt to Michael Kay
It looks like the underlying problem is with SaxonJ 12.0.
- Project changed from SaxonC to Saxon
- Category deleted (
Saxon-C Internals)
- Status changed from New to In Progress
- Priority changed from Low to Normal
- Found in version deleted (
11.99)
- Platforms .NET, Java added
- Applies to branch 12, trunk added
In the past XdmNode had its own toString() method. It now inherits from XdmValue.toString(). This uses the Adaptive serialization method. It sets the serialization options indent=yes, but at AdaptiveEmitter.serializeNode()
line 230 this is overridden with indent=no.
I changed that and it made no difference.
In the serialization properties as passed to QueryResult.serialize(), the "indent" property has the value "true", but the SerializerFactory
is expecting "yes". On public APIs this would be caught by validation, but it's not being checked when we set the values internally.
Having fixed this, I'm seeing test failures because the serialized output of a node contains a trailing newline, which unit tests aren't expecting.
- Category set to Serialization
- Status changed from In Progress to Resolved
- Fix Committed on Branch 12, trunk added
I have expanded the Javadoc for XdmValue.toString()
to set expectations more clearly, and have added tests. Trailing newlines are now removed from the result.
- Subject changed from default toString() of an XdmNode not indent SaxonC to XdmNode.toString() is no longer indented
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.1 added
Bug fix applied in the Saxon 12.1 maintenance release.
Please register to edit this issue
Also available in: Atom
PDF