java sax parser special characters

Discussion in 'Java' started by shivaraj, Jun 12, 2008.

  1. shivaraj

    shivaraj Guest

    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
    shivaraj, Jun 12, 2008
    #1
    1. Advertising

  2. shivaraj

    Roedy Green Guest

    On Thu, 12 Jun 2008 03:33:01 -0700 (PDT), shivaraj
    <> 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
    Roedy Green, Jun 13, 2008
    #2
    1. Advertising

  3. shivaraj

    Arne Vajhøj Guest

    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
    Arne Vajhøj, Jun 15, 2008
    #3
  4. shivaraj

    shivaraj Guest

    On Jun 15, 11:08 pm, Arne Vajhøj <> 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
    shivaraj, Jul 7, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. leo
    Replies:
    1
    Views:
    625
    Adam Maass
    Apr 13, 2005
  2. Stefan Mueller
    Replies:
    3
    Views:
    32,953
    Stefan Mueller
    Jul 23, 2006
  3. Replies:
    2
    Views:
    692
    Joseph Kesselman
    Apr 17, 2007
  4. Replies:
    2
    Views:
    1,070
    Ingo Menger
    May 31, 2007
  5. rvino
    Replies:
    0
    Views:
    4,635
    rvino
    Aug 14, 2007
Loading...

Share This Page