Prevent Ampersand Escaping
"Friessen, Michelle" <[email protected]> Tue, 14 Jan 2014 11:13:46 -0600
| Newsgroups | gmane.text.xml.xmlbeans.user |
|---|---|
| Message-ID | <CANm+gpER45k1GrrChOEPXuHif=FvWtpH4O-EwY4LNjpau1kesw@mail.gmail.com> |
--f46d0435c068ad02d004eff150ac
Content-Type: text/plain; charset=ISO-8859-1
Greetings,
Is there any way to stop XMLBeans version 2.5.0 from escaping the
ampersand? Per system requirements, I am converting special characters as
follows:
return str.replace("&", "&").replace("\"", """).replace("'",
"'").replace("<", "<").replace(">", ">");
However, xmlbeans is escaping the ampersand (" becomes &x0022;);
therefore, the character comes out as code (&#x0026; instead of &) when
the XML is read by another application.
XmlOptionCharEscapeMap does not have the capability to handle the codes I
need to use. When I specify
escapes.addMapping('&', XmlOptionCharEscapeMap.HEXADECIMAL);
the ampersand comes out as & instead of &.
It's likely that someone is going to respond saying xmlbeans has to escape
the ampersand because it is a mandatory restriction of XML. If that is a
response, then please provide some type of solution to my problem because I
have to use the codes listed above.
Thanks.
-- Michelle
--f46d0435c068ad02d004eff150ac
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Greetings,</div><div><br></div><div>Is there any way =
to stop XMLBeans version 2.5.0 from escaping the ampersand? =A0Per system r=
equirements, I am converting special characters as follows:</div><div><br><=
/div>
<div>return str.replace("&", "&#x0026;").replac=
e("\"", "&#x0022;").replace("'",=
"&#x0027;").replace("<", "&#x003C;&quo=
t;).replace(">", "&#x003E;");<br>
</div><div><br></div><div>However, xmlbeans is escaping the ampersand (&=
;#x0022; becomes &amp;x0022;); therefore, the character comes out as co=
de (&amp;#x0026; instead of &) when the XML is read by another appl=
ication.</div>
<div><br></div><div>XmlOptionCharEscapeMap does not have the capability to =
handle the codes I need to use. =A0When I specify</div><div><br></div><div>=
escapes.addMapping('&', XmlOptionCharEscapeMap.HEXADECIMAL);</d=
iv>
<div><br></div><div>the ampersand comes out as &amp; instead of &#x=
26;.</div><div><br></div><div>It's likely that someone is going to resp=
ond saying xmlbeans has to escape the ampersand because it is a mandatory r=
estriction of XML. =A0If that is a response, then please provide some type =
of solution to my problem because I have to use the codes listed above.</di=
v>
<div><br></div><div>Thanks.</div><div><br></div><div><div>-- Michelle</div>=
</div>
</div>
--f46d0435c068ad02d004eff150ac--