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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:50:28+00:00 2026-06-15T15:50:28+00:00

I found some posts related to this issue but not able to find the

  • 0

I found some posts related to this issue but not able to find the solution. Problem is that on character() function, ch[] array contains incomplete or last elements from last call and this happens sometimes but 98% of times works properly. File name has no special chars and no strange names.

if we have,

<tag>image1test.jpg<tag> 
<tag>image2bla.jpg<tag>

when working, char array contains proper values but when not, when characters function is called for second tag from example, we get,

[i,m,a,g,e,2,b,e,s,t] (residual chars from last call)

how to solve it? thanks.

@Override
public void characters(char ch[], int start, int length) {
if(this.v_new){
myNewsXMLDataSet.setNews(new String(ch, start, length));

}
  • 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-15T15:50:29+00:00Added an answer on June 15, 2026 at 3:50 pm

    The parser isn’t required to call characters(char[],int,int) on your handler only once. You’ve got to expect multiple calls, and process the value only after the endElement() method has been called.

    public class Handler extends DefaultHandler {
    
        private StringBuilder sb = new StringBuilder();
        @Override
        public void characters(char[] ch, int start, int length) throws SAXException {
            sb.append(ch, start, length);
    
        }
    
        @Override
        public void endElement(String uri, String localName, String qName) throws SAXException {
            doStuffWith(sb.toString());
            sb = new StringBuilder();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found some posts related to search on XML but those were not
ok, i found some similar posts on stackoverflow, but I couldn't find any that
I have checked few other posts and found some UIAnimation transitions that kind-of give
I am asking this question, because I didn't find yet any posts that are
I've got a trait that looks like this (some further information can be found
I found some classes designed for debugging in package com.sun.jdi like VirtualMachine , but
I found some old Python code that was doing something like: if type(var) is
Apologies, this is a duplicate of entry of this post but I found I'm
I have some weeks since im using CI, but now I've found some problems
This Question is Related to my earlier post here: CSS loading issue with Android

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.