serialize tree, node has quote as part of the value

When serializing a tree. If some node has a quote as part of the text value, this does not get properly encoded, making the XML unparsable by the consumer of this xml.



This is an example of the Serialized output:

<?xml version="1.0"?>



<item id=“1234” select=“1” text="New Node with a quote “”>











Notice the Quote at the end of the text attribute. This quote is there on purpose. It should be encoded or escaped on the XML, so a XML parser can identify the end of the attribute value.



Is there a setting that I am missing that will encode/escape the text values?

You can use
tree.registerXMLEntity(’"’,’ any replacement here ')
tree.setSerializationLevel(false,false,true);