Bug #5788
closedXdmNode.toString() is no longer indented
100%
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)
Updated by O'Neil Delpratt almost 2 years ago
- Assignee changed from O'Neil Delpratt to Michael Kay
It looks like the underlying problem is with SaxonJ 12.0.
Updated by Michael Kay almost 2 years ago
- 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.
Updated by Michael Kay almost 2 years ago
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.
Updated by Michael Kay almost 2 years ago
- 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.
Updated by Michael Kay almost 2 years ago
- Subject changed from default toString() of an XdmNode not indent SaxonC to XdmNode.toString() is no longer indented
Updated by O'Neil Delpratt almost 2 years ago
- 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