DOMParser domp = new DOMParser(); domp.setErrorHandler(new ErrorHandler(){
myDOMParser.setErrorHandler(new ErrorHandler(){
    private void processDataFromConnection_asXML(String str)    {               try{                    //ByteArrayInputStream bais = new ByteArrayInputStream(str.getBytes());                    //InputSource is = new InputSource(bais);                    StringReader sr = new StringReader(str.trim());                    InputSource is = new InputSource(sr);                    //System.err.println("str=" + str);                    //FileReader freader = new FileReader("task.xml");                    //InputSource is = new InputSource(freader);                    DOMParser domp = new DOMParser();                    domp.setErrorHandler(new ErrorHandler(){                          public void error(SAXParseException exception) {                             System.err.println("[ErrorHandler.error]: " + exception);                           }                           public void fatalError(SAXParseException exception) {                                 System.err.println("[ErrorHandler.fatalError]: " + exception);                           }                           public void warning(SAXParseException exception) {                                 System.err.println("[ErrorHandler.warning]: " + exception);                            }                        }                    );                    domp.parse(is);                    Document doc = domp.getDocument();                    System.out.println("Is XML");                    if( doc != null ) {                       PlanObject p = new PlanObject(doc);                       publishAdd(p);                    }                } catch ( SAXParseException sax) {                    //                    // if we see this, assume this is not valid XML                    //                    System.out.println("Not XML");                    System.out.println("\n[AggregatorPlugin] data=" + str + "\n");                } catch (Exception ex ){                    ex.printStackTrace();                }    }