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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:22:48+00:00 2026-05-15T20:22:48+00:00

Respected All, I have to read XML file, for that I use SAXParser and

  • 0

Respected All,
I have to read XML file, for that I use SAXParser and DefaultHandler using method characters(char[] ch, int start, int length) but it gives output with some extra characters such as [] in place of ‘#13’. someone told me that if I read that string in UTF-8 format then it will remove that all the extra characters. Is it true that I have to read it in UTF-8 format if yes then how I can read it.
Thank You
(Vikram Kadam)

  • 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-15T20:22:49+00:00Added an answer on May 15, 2026 at 8:22 pm

    I use this to parse with the SAXparser :

    URL url = new URL(urlToParse);
    SAXParserFactory spf = SAXParserFactory.newInstance();
    // here we get our SAX parser
    SAXParser sp = spf.newSAXParser();
    // we fuse it to a XML reader
    XMLReader xr = sp.getXMLReader();
    DefaultHandler handlerContact = new DefaultHandler();
    // we give it a handler to manage the various events
    xr.setContentHandler(handlerContact);
    // and finally we open the stream to the url
    InputStream oS = url.openStream();
    // and parse it
    xr.parse(new InputSource(new InputStreamReader(oS, Charset.forName("utf-8"))));
    // to retrieve the list of contacts created by the handler
    result = handlerContact.getEntries();
    // don't forget to close the resource
    oS.close();
    

    I never had any trouble as long as the initial file you are parsing is properly encoded in UTF-8. Check if it is, because sometimes, when you use default configuration of your computer, default is not UTF-8 but ANSI or ISO-8859-1

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

Sidebar

Related Questions

I have to write a program that read from a file that contains the
Respected sir/madam, I have a fortran exe which takes a input file and produces
I have read some tips that multithread implementation largely depends on the target OS
I have two files file a.) xmlFile.xml b.) emails.txt xmlFile.xml has the following structure
I want to select all the rows in a table that have a particular
First I have read all questions about this subject, so this is not a
I have a file that contains the following type and structure of data: <data>
This is not a biggie at all, but something that would be very helpful
I haven't found a comprehensive list of the steps that are required to use
If I have an apache file in /etc/apache2/sites-available/www.example.com and I set its filetype like

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.