Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java sax parser special characters

Reply
Thread Tools

java sax parser special characters

 
 
shivaraj
Guest
Posts: n/a
 
      06-12-2008
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
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      06-13-2008
On Thu, 12 Jun 2008 03:33:01 -0700 (PDT), shivaraj
<(E-Mail Removed)> wrote, quoted or indirectly quoted
someone who said :

>I am getting special characters in my xml file because of which the
>parser is failing.


I have written a tool that will interconvert between Unicode and
entity form for awkward characters. See
http://mindprod.com/products1.html#ENTITIES
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
 
 
 
Arne Vajhj
Guest
Posts: n/a
 
      06-15-2008
shivaraj wrote:
> 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 &amp; 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
 
Reply With Quote
 
shivaraj
Guest
Posts: n/a
 
      07-07-2008
On Jun 15, 11:08*pm, Arne Vajhj <(E-Mail Removed)> wrote:
> shivaraj wrote:
> > 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 &amp; 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


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove only special characters and junk characters from a file rvino Perl 0 08-14-2007 07:23 AM
Re: Meta-Characters, Special Characters xah@xahlee.org Java 2 05-31-2007 09:25 AM
C++ SAX Parser ---handling special characters mamatha.kumar@gmail.com XML 2 04-17-2007 05:44 PM
How to convert HTML special characters to the real characters with a Java script Stefan Mueller HTML 3 07-23-2006 10:09 PM
SAX parser: problems with overwritten characters method leo Java 1 04-13-2005 02:26 PM



Advertisments