FileDocCategorySizeDatePackage
Xerces.javaAPI DocApache Xerces 3.0.14099Fri Sep 14 20:33:58 BST 2007dom.wrappers

Xerces

public class Xerces extends Object implements ErrorHandler, dom.ParserWrapper, ParserWrapper.DocumentInfo
Wraps the Xerces DOM parser.
version
$Id: Xerces.java 447683 2006-09-19 02:36:31Z mrglavas $

Fields Summary
protected org.apache.xerces.parsers.DOMParser
parser
Parser.
Constructors Summary
public Xerces()
Default constructor.


    //
    // Constructors
    //

       
      
        parser.setErrorHandler(this);
    
Methods Summary
public voiderror(org.xml.sax.SAXParseException ex)
Error.

        printError("Error", ex);
    
public voidfatalError(org.xml.sax.SAXParseException ex)
Fatal error.

        printError("Fatal Error", ex);
        throw ex;
    
public ParserWrapper.DocumentInfogetDocumentInfo()
Returns the document information.

        return this;
    
public booleanisIgnorableWhitespace(org.w3c.dom.Text text)
Returns true if the specified text node is ignorable whitespace.

        return ((TextImpl)text).isIgnorableWhitespace();
    
public org.w3c.dom.Documentparse(java.lang.String uri)
Parses the specified URI and returns the document.

        parser.parse(uri);
        return parser.getDocument();
    
protected voidprintError(java.lang.String type, org.xml.sax.SAXParseException ex)
Prints the error message.


        System.err.print("[");
        System.err.print(type);
        System.err.print("] ");
        String systemId = ex.getSystemId();
        if (systemId != null) {
            int index = systemId.lastIndexOf('/");
            if (index != -1)
                systemId = systemId.substring(index + 1);
            System.err.print(systemId);
        }
        System.err.print(':");
        System.err.print(ex.getLineNumber());
        System.err.print(':");
        System.err.print(ex.getColumnNumber());
        System.err.print(": ");
        System.err.print(ex.getMessage());
        System.err.println();
        System.err.flush();

    
public voidsetFeature(java.lang.String featureId, boolean state)
Sets a feature.

        parser.setFeature(featureId, state);
    
public voidwarning(org.xml.sax.SAXParseException ex)
Warning.

        printError("Warning", ex);