java sax parser special characters

S

shivaraj

Hi,

I am getting special characters in my xml file because of which the
parser is failing. I know that we can replace the special characters
by & kind of place holders to make it work. But my trouble is, the
xml file will be generated by calling some API's. We cant read each
characters of the return value of this API to check for special
character and replace it. (XML file is having more than 2 lakh lines)
So is there a easy way of forming this XML which will take the whole
string having special characters into double quotes "' and treat it as
a single string?( I tried double quotes but it did not work...any
other approach please!? )

Regards,
Shivaraj
 
A

Arne Vajhøj

shivaraj said:
I am getting special characters in my xml file because of which the
parser is failing. I know that we can replace the special characters
by & kind of place holders to make it work. But my trouble is, the
xml file will be generated by calling some API's. We cant read each
characters of the return value of this API to check for special
character and replace it. (XML file is having more than 2 lakh lines)
So is there a easy way of forming this XML which will take the whole
string having special characters into double quotes "' and treat it as
a single string?( I tried double quotes but it did not work...any
other approach please!? )

&<> should be encoded as &amp; &lt; &gt; and all other special
characters should work if the actual encoding matches the one
in the XML declaration.

Arne
 
S

shivaraj

&<> should be encoded as &amp; &lt; &gt; and all other special
characters should work if the actual encoding matches the one
in the XML declaration.

Arne

Hi All,
Thanks for your help. I was able to rectify this by using <!
[CDATA[ string ]> format. I appended all my strings in CDATA section.
Thus it got resolved.
Regards,
shivaraj
 

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,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top