public Element parse(Reader is){
  buffOffset=0;
  buffSize=-1;
  eventParser=false;
  Element rootElement=createNewElement("ROOT");
  try {
    parseTagContent(rootElement,is);
  }
 catch (  IOException ioe) {
    ioe.printStackTrace();
  }
  if (rootElement.getNumChildren() == 0) {
    notifyError(ParserCallback.ERROR_NO_ROOTS,null,null,null,"XML document contains no root element.");
    return null;
  }
 else   if (rootElement.getNumChildren() > 1) {
    String roots="";
    for (int i=1; i < rootElement.getNumChildren(); i++) {
      Element elem=rootElement.getChildAt(i);
      if (elem.isTextElement()) {
        roots+="Text (" + elem.getText() + "),";
      }
 else {
        roots+=elem.getTagName() + ",";
      }
    }
    if (roots.endsWith(",")) {
      roots=roots.substring(0,roots.length() - 1);
    }
    Element firstRoot=rootElement.getChildAt(0);
    String str=null;
    if (firstRoot.isTextElement()) {
      str="TEXT:" + firstRoot.getText();
    }
 else {
      str=firstRoot.getTagName();
    }
    notifyError(ParserCallback.ERROR_MULTIPLE_ROOTS,null,null,null,"XML document contains multiple root elements, only the first root (" + str + ") will be used. Excessive roots: "+ roots);
  }
  rootElement=rootElement.getChildAt(0);
  return rootElement;
}

public Element parse ( Reader is ) { buffOffset = 0 ; buffSize = - 1 ; eventParser = false ; Element rootElement = createNewElement ( "ROOT" ) ; try { parseTagContent ( rootElement , is ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } if ( rootElement . getNumChildren ( ) == 0 ) { notifyError ( ParserCallback . ERROR_NO_ROOTS , null , null , null , "XML document contains no root element." ) ; return null ; } else if ( rootElement . getNumChildren ( ) > 1 ) { String roots = "" ; for ( int i = 1 ; i < rootElement . getNumChildren ( ) ; i ++ ) { Element elem = rootElement . getChildAt ( i ) ; if ( elem . isTextElement ( ) ) { roots += "Text (" + elem . getText ( ) + ")," ; } else { roots += elem . getTagName ( ) + "," ; } } if ( roots . endsWith ( "," ) ) { roots = roots . substring ( 0 , roots . length ( ) - 1 ) ; } Element firstRoot = rootElement . getChildAt ( 0 ) ; String str = null ; if ( firstRoot . isTextElement ( ) ) { str = "TEXT:" + firstRoot . getText ( ) ; } else { str = firstRoot . getTagName ( ) ; } notifyError ( ParserCallback . ERROR_MULTIPLE_ROOTS , null , null , null , "XML document contains multiple root elements, only the first root (" + str + ") will be used. Excessive roots: " + roots ) ; } rootElement = rootElement . getChildAt ( 0 ) ; return rootElement ; }
this is the entry point for parsing a document and the only non - private member method in this class
