Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6905939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:14:45+00:00 2026-05-27T08:14:45+00:00

I am reading a XML using SAX ( javax.xml.parsers.SAXParser; ). In that XML, there

  • 0

I am reading a XML using SAX (javax.xml.parsers.SAXParser;). In that XML, there are some special character like (&,<,>,”,’) available among the child node values. So, upto that point SAX read the XML successfully, but on that point it throws a org.xml.sax.SAXParseException.

For an example, in the below sample XML, SAX reads up to the node value of the successfully. But it throws this org.xml.sax.SAXParseException at the since the value of Name argument has < in there.

<Parent>
   <child1>
      LS-23541723
   </child1>
   <child2 id="2" Name="T-Shirt And Denim - T<D" Rate="500.00">
   </child2>
   <child3>
      <![CDATA[This is the child 2]]>
   </child3>
   <child4>
      <![CDATA[This is the child 4]]>
   </child4>
</Parent>

I can’t determine the nodes that contains these special characters before hand.(It is dyanamic.) So, What I wanna do is, reading an XML with SAX, ignoring the nodes that contains these like special characters.. Simply, I think I can do this if it is possible to read the XML with SAX, skipping the nodes that pass the org.xml.sax.SAXParseException.

Is this possible and if yes how?

Note : I cannot simply replace them with the Entity Refrences like &amp; since, some times the XML nodes are comming with the &lt; , &gt; as well ( is comming as &lt;child1&gt;). So, before starting to read it with SAX, I replace all the Entity References with the Character References.(replaceAll("&gt;",">"),etc)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:14:46+00:00Added an answer on May 27, 2026 at 8:14 am

    I don’t think that SAX can handle this. The XML has to be well-formed. Thus you have to make a bunch of replacements before the text is submitted to SAX. Look for any ', " or < that are not in the right places. " between ", ' between ' and < that is not part of a start tag or end tag. That should be feasible. That’s the second pass after your first pass that replaces &lt; and &gt; by their equivalent counterparts.
    Ideally you should also watch for comments, CDATA section, etc… to be sure they are well-formed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading an XML document using JavaScript & jQuery, and need to extract some
Im having some trouble reading xml files using jquery that containts swedish chars (åäö)
I'm reading some XML with PHP and currently using the DOMDocument class to do
I am reading an XML file using an XMLTextReader. Is there a way to
I am reading HTML files from a folder using xml parser that store the
I'm familiar with using the MSXML2 library for reading xml files. But is there
I'm reading some XML with XmlReader using the following code: XmlReaderSettings settings = new
I am reading an xml file using javascript and then I need to submit
Apple strongly recommends using the binary plist format when reading large XML-based data sets
I'm using Qt C++ and am reading in an XML file for data. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.