Glenn9999
Finally got time to have a look at this.
I created an XML document like this.
XML:
<?xml version="1.0" encoding="utf-8"?>
<foo>
<bar>Henry & June</bar>
</foo>
After loaded through MSXML, [tt]selectNodes("foo/bar").item(0).text[/tt] returns [tt]Henry & June[/tt], as expected.
When saved using MSXML's [tt]save()[/tt] method, the resulting document is exactly this, again as expected:
XML:
<?xml version="1.0" encoding="utf-8"?>
<foo>
<bar>Henry & June</bar>
</foo>
Then, I created a new element, using MSXML's [tt]createElement("bar")[/tt], set its [tt]text[/tt] to [tt]"<>'[/tt], inserted it as foo's child with the [tt]appendChild()[/tt] method, and saved the result again.
This was the result:
XML:
<?xml version="1.0" encoding="utf-8"?>
<foo>
<bar>Henry & June</bar>
<bar>"<>'</bar></foo>
Finally, I created a new attribute with [tt]createAttribute("attr")[/tt] and set its value to [tt]"<>'[/tt], and set it as a foo's attribute with [tt]attributes.setNamedItem()[/tt] method. When saved, it ended up as:
XML:
<?xml version="1.0" encoding="utf-8"?>
<foo attr=""<>'">
<bar>Henry & June</bar>
<bar>"<>'</bar></foo>
This seems ok with me and results in well-formed XML that any XML parser should be able to read. Are you doing things differently?
Note: using MSXML2.DOMDocument.6.0, as I normally do.