Code example for SAXParseException

Methods: getColumnNumber, getLineNumber, getMessage, getPublicId, getSystemId

0
                                     exception.getException());
    } // createSAXParseException(XMLParseException):SAXParseException 
 
    /** Creates an XMLParseException from a SAXParseException. */ 
    protected static XMLParseException createXMLParseException(SAXParseException exception) {
        final String fPublicId = exception.getPublicId();
        final String fExpandedSystemId = exception.getSystemId();
        final int fLineNumber = exception.getLineNumber();
        final int fColumnNumber = exception.getColumnNumber();
        XMLLocator location = new XMLLocator() {
            public String getPublicId() { return fPublicId; }
            public String getExpandedSystemId() { return fExpandedSystemId; }
            public String getBaseSystemId() { return null; }
            public String getLiteralSystemId() { return null; }
            public int getColumnNumber() { return fColumnNumber; }
            public int getLineNumber() { return fLineNumber; }
            public int getCharacterOffset() { return -1; } 
            public String getEncoding() { return null; }
            public String getXMLVersion() { return null; }
        }; 
        return new XMLParseException(location, exception.getMessage(),exception);
    } // createXMLParseException(SAXParseException):XMLParseException 
 
    /** Creates an XNIException from a SAXException.  
        NOTE:  care should be taken *not* to call this with a SAXParseException; this will 
        lose information!!! */