Apostrope problem with xalan 2.7.0

N

Nirmal

Hi everyone,

While using xalan 2.1.0 and xerces 1.4.3 jars, the out file will have
the "'" in place of
" ' " Literal in input file.
When we use the latest version of xalan 2.7.0 and xerces 2.8.0, it will
result the same " ' " literal in out file,

The classes and methods that we suspected regarding this conversion are


OutputFormat format = new OutputFormat ("xml", encoding, indentResult);

format.setOmitXMLDeclaration (true);

serializer = new XMLSerializer (outputStream, format);



We need "'" in output file, can anyone help me in this regard.


Thanks and Regards
Nirmal JS
 
M

Martin Honnen

Nirmal wrote:

While using xalan 2.1.0 and xerces 1.4.3 jars, the out file will have
the "'" in place of
" ' " Literal in input file.
When we use the latest version of xalan 2.7.0 and xerces 2.8.0, it will
result the same " ' " literal in out file,

We need "'" in output file, can anyone help me in this regard.

Why? The only requirement to escape the single quote is if you have an
attribute value delimited by single quotes where the value contains a
single quote e.g.
<element att1='&apos;'>
Otherwise a literal single quote ' works just fine.
 
R

Richard Tobin

We need "&apos;" in output file, can anyone help me in this regard.

You shouldn't rely on this. XML tools may produce any equivalent
output (and &apos; is equivalent to an apostrophe), so you will always
be at risk of getting the "wrong" thing if you demand &apos;.

Of course, if you are processing the output as an XML document, it
should work perfectly well whichever you get.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top