title: JAVA SAX parser split calls to characters()
body: <p>I am doing a project to parse some data from the XML.</p>
  
  <p>For example, the XML is</p>
  
  <pre><code>&lt;abc&gt;abcdefghijklmno&lt;/abc&gt;
  </code></pre>
  
  <p>I need to parse "abcdefghijkmnlp".</p>
  
  <p>But while I test my parse, I discover a big problem:</p>
  
  <pre><code>public class parser{
      private boolean hasABC = false;
  
  
          //Constructor HERE
          ......................
          ......................
  
       @Override
       public void startDocument () throws SAXException{  
       }
  
       @Override
       public void endDocument () throws SAXException{  
       }
  
       @Override
       public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException{  
            if ("abc".equalsIgnoreCase(localName)) {
                this.hasABC = true;
            }
        }
        @Override
        public void endElement(String namespaceURI, String localName, String qName) throws SAXException{
              if ("abc".equalsIgnoreCase(localName)) {
                   this.hasABC = false;
              }
         }
         @Override
         public void characters(char ch[], int start, int length){
              String content = new String(ch, start, length).trim(); 
              if(this.hasABC){
                   System.out.println("ABC = " + content);
              }
          }
      }
  </code></pre>
  
  <p>I discover that the parser has parsed the  tag two time
  System print out is,</p>
  
  <p>ABC = abcdefghi</p>
  
  <p>ABC = jklmno                &lt;&lt;============ split the message</p>
  
  <p>Why the parser auto call back the characters() two time????</p>
  
  <p>Is the XML haveing some "\n" or "\r" ???</p>