XMLReader reader = null; Parser parser = null;   try { reader = _config.getXMLReader(); if (entityResolver != null) reader.setEntityResolver(entityResolver); } catch(RuntimeException rx) { if (_debug) { String err = "Unable to create SAX XMLReader, attempting SAX Parser."; if (_pw != null) { _pw.println(err); } else { System.out.println(err); } } }  if (reader == null) { parser = _config.getParser(); if (parser == null) throw new MarshalException("Unable to create SAX Parser."); if (entityResolver != null) parser.setEntityResolver(entityResolver); }   UnmarshalHandler handler = createHandler();   try { if (reader != null) { reader.setContentHandler(handler); reader.setErrorHandler(handler); reader.parse(source); } else { parser.setDocumentHandler(handler); parser.setErrorHandler(handler); parser.parse(source); } } catch(java.io.IOException ioe) { throw new MarshalException(ioe); } catch(org.xml.sax.SAXException sx) { Exception except = sx.getException(); if (except == null) except = sx; MarshalException marshalEx = new MarshalException(except); if ( handler.getDocumentLocator() != null ) { FileLocation location = new FileLocation(); location.setFilename(handler.getDocumentLocator().getSystemId()); location.setLineNumber(handler.getDocumentLocator().getLineNumber()); location.setColumnNumber(handler.getDocumentLocator().getColumnNumber()); marshalEx.setLocation(location); } throw marshalEx; }  return handler.getObject(); }
return unmarshal(new InputSource(reader)); }
    public Object unmarshal(InputSource source)        throws MarshalException, ValidationException    {        XMLReader reader = null;        Parser parser = null;                //-- First try XMLReader        try {            reader = _config.getXMLReader();            if (entityResolver != null)                reader.setEntityResolver(entityResolver);        }        catch(RuntimeException rx) {            if (_debug) {                String err = "Unable to create SAX XMLReader, attempting SAX Parser.";                if (_pw != null) {                    _pw.println(err);                }                else {                    System.out.println(err);                }            }        }                if (reader == null) {            parser = _config.getParser();            if (parser == null)                throw new MarshalException("Unable to create SAX Parser.");            if (entityResolver != null)                parser.setEntityResolver(entityResolver);        }        UnmarshalHandler handler = createHandler();                try {            if (reader != null) {                reader.setContentHandler(handler);                reader.setErrorHandler(handler);                reader.parse(source);            }            else {                parser.setDocumentHandler(handler);                parser.setErrorHandler(handler);                parser.parse(source);            }        }        catch(java.io.IOException ioe) {            throw new MarshalException(ioe);        }        catch(org.xml.sax.SAXException sx) {            Exception except = sx.getException();            if (except == null) except = sx;            MarshalException marshalEx = new MarshalException(except);            if ( handler.getDocumentLocator() != null ) {                FileLocation location = new FileLocation();                location.setFilename(handler.getDocumentLocator().getSystemId());                location.setLineNumber(handler.getDocumentLocator().getLineNumber());                location.setColumnNumber(handler.getDocumentLocator().getColumnNumber());                marshalEx.setLocation(location);            }            throw marshalEx;        }        return handler.getObject();    } //-- unmarshal(InputSource)