Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda