Michelle,

You're right, XML content that contains & and < needs to be escaped and
XmlBeans does that even if you try to escape it beforehand, which is not
right. You're also right that using XmlOptionCharEscapeMap doesn't
affect them, if you know what you're doing you can look at the code that
does the escaping: src/store/org/apache/xmlbeans/impl/store/Saver.java
lines 1419-1422.

This is a strange request since all XML processors should know how to
handle &amp; and &lt; correctly.

hth,
Cezar

On Tue, 2014-01-14 at 09:13 -0800, Friessen, Michelle wrote:
> 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("&", "&#x0026;").replace("\"",
> "&#x0022;").replace("'", "&#x0027;").replace("<",
> "&#x003C;").replace(">", "&#x003E;");
> 
> 
> 
> However, xmlbeans is escaping the ampersand (&#x0022; becomes
> &amp;x0022;); therefore, the character comes out as code (&amp;#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 &amp; instead of &#x26;.
> 
> 
> 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



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org

Reply via email to