Project

Profile

Help

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.


    (1-2/2)

    Please register to reply