Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
DomParser JS changes attribute values

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;amp;*()_-+={}|\\\\][:&amp;quot;;&amp;apos;&amp;lt;&amp;gt;,./_æåøÆÅØ_色" type="major" date="2022-05-25T13:53:28.650" comment="`~!@#$%^&amp;amp;*()_-+={}|\\\\][:&amp;quot;;&amp;apos;&amp;lt;&amp;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:

'`~!@#$%^&amp;*()_-+={}|\\\\][:&quot;;&apos;&lt;&gt;,./_æåøÆÅØ_色'

I have initialized the DOMParser like:

xmlDoc = parser.parseFromString(
                        xml,
                        'application/xml'
                    );

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Special characters have to be escaped in XML/HTML, for example & has to be escaped as &amp;, and the job of the parser is to give you the original unescaped value. So if the lexical XML contains &amp;, the parser will give you &, and if the lexical XML contains &amp;amp;, the parser will give you &amp;.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!