1

Having the next simplification of a problematic XML code:

<A>
    <B someAttr="http://someURL?par1=AAA&par2=BBB">
    </B>
</A>

...when I try to load it in the browser it provides the following error message:

Error de lectura XML: mal formado
Ubicación: file:///C:/GESMED/ws-eclipse-GESMED-ZCAS/Z-AUX/xml/3.xml
Número de línea 3, columna 43:  <B someAttr="http://someURL?par1=AAA&par2=BBB">
-------------------------------------------------------------------------^

Does somebody know how to fix it?

(Note: it complains about the the second '=')

Meta
  • 45
  • 11
JLLMNCHR
  • 1,551
  • 5
  • 24
  • 50

1 Answers1

2

& must be escaped in XML as &amp; when not being used as an entity reference.

Update the originating program or edit the XML manually. If you cannot control this input XML, then see How to parse invalid (bad / not well-formed) XML?

(Note it complains of the second '=')

= is fine. The error arrow, ^, is only pointing to = because it's the first character after &par2 for which the lexer can know that it's not working on an entity name that will be ending with a ;.

kjhughes
  • 106,133
  • 27
  • 181
  • 240