Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda