org.w3c.dom.Node.setNodeValue() not encoding certain special characters



Using Java, I set the value of a <value> attribute in an xml file to be


String val = "~!@#$%^&*()_+-={}|[]\\:\";'<>?,./;"


When I tried to use the api with input


org.w3c.dom.Node.setNodeValue(val)


and take a look at the xml, I see that the value attribute in the resulting xml looks this way-


<Value>~!@#$%^&amp;*()_+-={}|[]\:";'&lt;>?,./</Value>


I'm trying to figure out why this third party API is encoding only < and &, but not >, ' or ".


No comments:

Post a Comment