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 7747629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:34:40+00:00 2026-06-01T10:34:40+00:00

When parsing an xml file in android, I’m doing like this: try { InputStream

  • 0

When parsing an xml file in android, I’m doing like this:

try
{
    InputStream is = ...
    MyContentHandler ch = new MyContentHandler();
    Xml.parse(is, Encoding.UTF_8, ch);
}
catch ...

The problem is that sometimes the file I’m trying to parse is not well-formed.
In my case, undeclared namespaces may be present.

The data I’m interested in is not inside those tags so I could simply ignore it, but I get an exception of unbound prefix not inside the content handler but in the parser itself; this means that if the exception occurs the entire parsing process is interrupted.

Is there a way of using the sax parser ignoring this kind of error (or namespaces at all)?

p.s. I want to avoid loading all the file in memory as a string and strip namespaces out of it, or having to rewrite the file.

  • 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-06-01T10:34:41+00:00Added an answer on June 1, 2026 at 10:34 am

    I found the solution in another thread.

    Instead of using Xml.parse you need to manually instantiate a sax parser through the SAXParserFactory and get a reader.

    You can then set the reader features.

    Among the available features, one disables namespaces and that does the trick.

    Reference -> LINK

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

Sidebar

Related Questions

I got a string from parsing a XML file which looks like this: Fri,
I am parsing an XML file through Android Pull Parser technique. First, have a
I want to use DOM4j for parsing xml file in Java. I have this
Here is my code: (source: http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/ ) Here is my XML file: removed On
I have xml file in server. I am parsing this xml using DOM(xml is
I have an xml file that looks like this: <!DOCTYPE ROOT SYSTEM zombie.dtd> <ROOT>
I am parsing an XML file for an Android app I am writing and
I am doing application with parsing XML file. I used TransformerFactory to modify XML
I am getting an Error parsing XML file: Unbound prefix when I try to
In android, through xml parsing i have xml file values in tableview now which

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.