Forums » Saxon/C Help and Discussions »
Is there a reason why the default toString() of an XdmNode with SaxonJ and SaxonCS seems to use indentation while that doesn't happen for SaxonC?
Added by Martin Honnen 11 months ago
With SaxonJ (tested with 11.4 HE) I find that the string representation (I supposed implemented by the toString()
method) of an XdmNode
indents the result, thus a sample like
DocumentBuilder docBuilder = processor.newDocumentBuilder();
XdmNode xdmNode1 = docBuilder.build(new StreamSource(new StringReader("<root><item>a</item><item>b</item><item>c</item></root>")));
System.out.println(xdmNode1);
outputs e.g.
<root>
<item>a</item>
<item>b</item>
<item>c</item>
</root>
Now with SaxonC ( think both 11.4 as well as 11.99 but currently testing with 11.99) a sample like
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)
outputs <root><item>a</item><item>b</item><item>c</item></root>
.
While it is probably user dependent and use case dependent what you want in a certain application I wonder why there is that difference between SaxonC and SaxonJ.
Replies (2)
RE: Is there a reason why the default toString() of an XdmNode with SaxonJ and SaxonCS seems to use indentation while that doesn't happen for SaxonC?
-
Added by O'Neil Delpratt 11 months ago
I have created a bug issue for this here: #5788
RE: Is there a reason why the default toString() of an XdmNode with SaxonJ and SaxonCS seems to use indentation while that doesn't happen for SaxonC?
-
Added by O'Neil Delpratt 11 months ago
It is possible this is a bug against SaxonJ 12.0. Still investigating
Please register to reply