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

  • Home
  • SEARCH
  • 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 6229311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:32:42+00:00 2026-05-24T09:32:42+00:00

Possible Duplicate: JAVA SAX parser split calls to characters() I have an XML file

  • 0

Possible Duplicate:
JAVA SAX parser split calls to characters()

I have an XML file with the following syntax:

<tag ...>
a bunch of text here
<tag ...>

There aren’t any closing tags for tag. I’m grabbing the text in-between the two tags, and storing them in a List<String> in characters (). It works for the most part, but on some xml files, it reads a line terminator or something, that breaks the text into two; rather than storing a single entry, “a bunch of text here”, I get two entries: “a bunch of”, and “text here”. The difference is that unlike all the other entries, it doesn’t store a line break after “a bunch of”, or before “text here”.

I need to fix this, but don’t know how. I’d appreciate your help.

  • 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-24T09:32:43+00:00Added an answer on May 24, 2026 at 9:32 am

    The parser is allowed to call the ContentHandler characters method multiple times for each string of element text, it’s not finding a line terminator necessarily. the Java tutorial on SAX has a short explanation of the characters method:

    Parsers are not required to return any particular number of characters at one time. A parser can return anything from a single character at a time up to several thousand and still be a standard-conforming implementation. So if your application needs to process the characters it sees, it is wise to have the characters() method accumulate the characters in a java.lang.StringBuffer and operate on them only when you are sure that all of them have been found.

    Also this Javaworld article has good explanations and examples.

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

Sidebar

Related Questions

Possible Duplicate: How can I convert my java program to an .exe file ?
Possible Duplicate: Get generic type of java.util.List I have a Map and I want
Possible Duplicate: How do you send email from a Java app using Gmail? How
Possible Duplicate: Pre & post increment operator behavior in C, C++, Java, & C#
Possible Duplicate: When to use “strictfp” keyword in java? What is the use of
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: Java : How to determine the correct charset encoding of a stream
Possible Duplicate: Java - simple division in Java ---> bug/feature? anyone know bigdecimal in
Possible Duplicate: Java equivalent to #region in c# Is there something in Java that
Possible Duplicate: Java: What is the difference between implementing Comparable and Comparator? Difference between

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.