I have a weird problem and are looking for an alternative or solution to the following:
I have the following xml stored in a string:
'<revision id="2832276" title="`~!@#$%^&amp;*()_-+={}|\\\\][:&quot;;&apos;&lt;&gt;,./_æåøÆÅØ_色" type="major" date="2022-05-25T13:53:28.650" comment="`~!@#$%^&amp;*()_-+={}|\\\\][:&quot;;&apos;&lt;&gt;,./_æåøÆÅØ_"/>'
now if notice the values of title it changes I copy paste it into chrome or if i use the DOM parser:
.getElementsByTagName('revision')[0].getAttribute('title')
I get:
'`~!@#$%^&*()_-+={}|\\\\][:";'<>,./_æåøÆÅØ_色'
I have initialized the DOMParser like:
xmlDoc = parser.parseFromString(
xml,
'application/xml'
);
Special characters have to be escaped in XML/HTML, for example & has to be escaped as &, and the job of the parser is to give you the original unescaped value. So if the lexical XML contains &, the parser will give you &, and if the lexical XML contains &amp;, the parser will give you &.