You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jeff Boston <da...@us.ibm.com> on 2004/05/05 17:02:50 UTC
DOM Serializer and escaping
Running Xerces 2.6.2 and noticed that sometime ' and > are escaped and
sometimes not. Further investigate revealed that this was jdk dependent.
If I run with 1.4.1 then the caracters are escaped ' and >, but if
I run with 1.4.2 or 1.5.0 then the characters aren't escaped. I expected
them to be escaped. Quering OutputFormat, there aren't any
NonEscapingElements.
with jdk 1.4.1
<Text string=""XML apostophe='" "XML
ampersand=&" "XML quote=\"" "XML greater
than=>" "XML less than=<"">
with jdk 1.4.2 & 1.5.0
<Text string=""XML apostophe='" "XML
ampersand=&" "XML quote=\"" "XML greater
than=>" "XML less than=<"">
Jeff
Re: DOM Serializer and escaping
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Joseph Kesselman <ke...@us.ibm.com> wrote on 05/05/2004 11:27:41 AM:
>
> The > character does not really need to be escaped, since there's no
> situation in which it can be misintepreted.
There is one case where it could be misinterpreted. Xerces now always
escapes the '>' character in content because the literal ']]>' (which is
also the end delimeter for a CDATA section) is not allowed to appear in
character data [1] and also because the serializer doesn't keep track of
what the previous characters serialized were.
> The ' character does not need to be escaped when it appears inside a
string
> delimited by ".
>
>
> I suspect the effect of changing JVMs is that you're changing which
version
> of Xerces you're picking up, since later JVMs carried Xerces inside
them. I
> know the Xalan FAQ has a discussion of how to override the Apache code
> packaged with the JVM; I presume the Xerces FAQ has similar advice.
>
> ______________________________________
> Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
> "The world changed profoundly and unpredictably the day Tim Berners Lee
> got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
[1] http://www.w3.org/TR/2004/REC-xml-20040204/#NT-CharData
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
Re: DOM Serializer and escaping
Posted by Joseph Kesselman <ke...@us.ibm.com>.
The > character does not really need to be escaped, since there's no
situation in which it can be misintepreted.
The ' character does not need to be escaped when it appears inside a string
delimited by ".
I suspect the effect of changing JVMs is that you're changing which version
of Xerces you're picking up, since later JVMs carried Xerces inside them. I
know the Xalan FAQ has a discussion of how to override the Apache code
packaged with the JVM; I presume the Xerces FAQ has similar advice.
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org