com.sun.org.apache.xerces.internal.xni.XMLLocator Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.xni.XMLLocator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ErrorHandlerWrapper.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** 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);
}
 
Example #2
Source File: SchemaDOMParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void startDocument(XMLLocator locator, String encoding,
        NamespaceContext namespaceContext, Augmentations augs)
throws XNIException {
    fErrorReporter = (XMLErrorReporter)config.getProperty(ERROR_REPORTER);
    fGenerateSyntheticAnnotation = config.getFeature(GENERATE_SYNTHETIC_ANNOTATION);
    fHasNonSchemaAttributes.clear();
    fSawAnnotation.clear();
    schemaDOM = new SchemaDOM();
    fCurrentAnnotationElement = null;
    fAnnotationDepth = -1;
    fInnerAnnotationDepth = -1;
    fDepth = -1;
    fLocator = locator;
    fNamespaceContext = namespaceContext;
    schemaDOM.setDocumentURI(locator.getExpandedSystemId());
}
 
Example #3
Source File: ErrorHandlerWrapper.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/** 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);
}
 
Example #4
Source File: AbstractDOMParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The start of the DTD.
 *
 * @param locator  The document locator, or null if the document
 *                 location cannot be reported during the parsing of
 *                 the document DTD. However, it is <em>strongly</em>
 *                 recommended that a locator be supplied that can
 *                 at least report the base system identifier of the
 *                 DTD.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void startDTD (XMLLocator locator, Augmentations augs) throws XNIException {
    if (DEBUG_EVENTS) {
        System.out.println ("==>startDTD");
        if (DEBUG_BASEURI) {
            System.out.println ("   expandedSystemId: "+locator.getExpandedSystemId ());
            System.out.println ("   baseURI:"+ locator.getBaseSystemId ());
        }
    }

    fInDTD = true;
    if (locator != null) {
        fBaseURIStack.push (locator.getBaseSystemId ());
    }
    if (fDeferNodeExpansion || fDocumentImpl != null) {
        fInternalSubset = new StringBuilder (1024);
    }
}
 
Example #5
Source File: AbstractDOMParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The start of the DTD.
 *
 * @param locator  The document locator, or null if the document
 *                 location cannot be reported during the parsing of
 *                 the document DTD. However, it is <em>strongly</em>
 *                 recommended that a locator be supplied that can
 *                 at least report the base system identifier of the
 *                 DTD.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void startDTD (XMLLocator locator, Augmentations augs) throws XNIException {
    if (DEBUG_EVENTS) {
        System.out.println ("==>startDTD");
        if (DEBUG_BASEURI) {
            System.out.println ("   expandedSystemId: "+locator.getExpandedSystemId ());
            System.out.println ("   baseURI:"+ locator.getBaseSystemId ());
        }
    }

    fInDTD = true;
    if (locator != null) {
        fBaseURIStack.push (locator.getBaseSystemId ());
    }
    if (fDeferNodeExpansion || fDocumentImpl != null) {
        fInternalSubset = new StringBuilder (1024);
    }
}
 
Example #6
Source File: XMLDTDProcessor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The start of the DTD.
 *
 * @param locator  The document locator, or null if the document
 *                 location cannot be reported during the parsing of
 *                 the document DTD. However, it is <em>strongly</em>
 *                 recommended that a locator be supplied that can
 *                 at least report the base system identifier of the
 *                 DTD.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {


    // initialize state
    fNDataDeclNotations.clear();
    fDTDElementDecls.clear();

    // the grammar bucket's DTDGrammar will now be the
    // one we want, whether we're constructing it or not.
    // if we're not constructing it, then we should not have a reference
    // to it!
   if( !fGrammarBucket.getActiveGrammar().isImmutable()) {
        fDTDGrammar = fGrammarBucket.getActiveGrammar();
    }

    // call handlers
    if(fDTDGrammar != null )
        fDTDGrammar.startDTD(locator, augs);
    if (fDTDHandler != null) {
        fDTDHandler.startDTD(locator, augs);
    }

}
 
Example #7
Source File: SchemaDOMParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void startDocument(XMLLocator locator, String encoding,
        NamespaceContext namespaceContext, Augmentations augs)
throws XNIException {
    fErrorReporter = (XMLErrorReporter)config.getProperty(ERROR_REPORTER);
    fGenerateSyntheticAnnotation = config.getFeature(GENERATE_SYNTHETIC_ANNOTATION);
    fHasNonSchemaAttributes.clear();
    fSawAnnotation.clear();
    schemaDOM = new SchemaDOM();
    fCurrentAnnotationElement = null;
    fAnnotationDepth = -1;
    fInnerAnnotationDepth = -1;
    fDepth = -1;
    fLocator = locator;
    fNamespaceContext = namespaceContext;
    schemaDOM.setDocumentURI(locator.getExpandedSystemId());
}
 
Example #8
Source File: SchemaDOMParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void startDocument(XMLLocator locator, String encoding,
        NamespaceContext namespaceContext, Augmentations augs)
throws XNIException {
    fErrorReporter = (XMLErrorReporter)config.getProperty(ERROR_REPORTER);
    fGenerateSyntheticAnnotation = config.getFeature(GENERATE_SYNTHETIC_ANNOTATION);
    fHasNonSchemaAttributes.clear();
    fSawAnnotation.clear();
    schemaDOM = new SchemaDOM();
    fCurrentAnnotationElement = null;
    fAnnotationDepth = -1;
    fInnerAnnotationDepth = -1;
    fDepth = -1;
    fLocator = locator;
    fNamespaceContext = namespaceContext;
    schemaDOM.setDocumentURI(locator.getExpandedSystemId());
}
 
Example #9
Source File: ErrorHandlerWrapper.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** 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);
}
 
Example #10
Source File: ErrorHandlerWrapper.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** 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);
}
 
Example #11
Source File: ErrorHandlerWrapper.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** 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);
}
 
Example #12
Source File: ErrorHandlerWrapper.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/** 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);
}
 
Example #13
Source File: XMLDTDProcessor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The start of the DTD.
 *
 * @param locator  The document locator, or null if the document
 *                 location cannot be reported during the parsing of
 *                 the document DTD. However, it is <em>strongly</em>
 *                 recommended that a locator be supplied that can
 *                 at least report the base system identifier of the
 *                 DTD.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {


    // initialize state
    fNDataDeclNotations.clear();
    fDTDElementDecls.clear();

    // the grammar bucket's DTDGrammar will now be the
    // one we want, whether we're constructing it or not.
    // if we're not constructing it, then we should not have a reference
    // to it!
   if( !fGrammarBucket.getActiveGrammar().isImmutable()) {
        fDTDGrammar = fGrammarBucket.getActiveGrammar();
    }

    // call handlers
    if(fDTDGrammar != null )
        fDTDGrammar.startDTD(locator, augs);
    if (fDTDHandler != null) {
        fDTDHandler.startDTD(locator, augs);
    }

}
 
Example #14
Source File: XIncludeHandler.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void startDTD(XMLLocator locator, Augmentations augmentations)
    throws XNIException {
    fInDTD = true;
    if (fDTDHandler != null) {
        fDTDHandler.startDTD(locator, augmentations);
    }
}
 
Example #15
Source File: XIncludeHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks if the file indicated by the given XMLLocator has already been included
 * in the current stack.
 * @param includedSource the source to check for inclusion
 * @return true if the source has already been included
 */
protected boolean searchForRecursiveIncludes(XMLLocator includedSource) {
    String includedSystemId = includedSource.getExpandedSystemId();

    if (includedSystemId == null) {
        try {
            includedSystemId =
                XMLEntityManager.expandSystemId(
                    includedSource.getLiteralSystemId(),
                    includedSource.getBaseSystemId(),
                    false);
        }
        catch (MalformedURIException e) {
            reportFatalError("ExpandedSystemId");
        }
    }

    if (includedSystemId.equals(fCurrentBaseURI.getExpandedSystemId())) {
        return true;
    }

    if (fParentXIncludeHandler == null) {
        return false;
    }
    return fParentXIncludeHandler.searchForRecursiveIncludes(
        includedSource);
}
 
Example #16
Source File: XMLSchemaValidator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void handleStartDocument(XMLLocator locator, String encoding) {
    fValueStoreCache.startDocument();
    if (fAugPSVI) {
        fCurrentPSVI.fGrammars = null;
        fCurrentPSVI.fSchemaInformation = null;
    }
}
 
Example #17
Source File: StaxErrorReporter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
Location convertToStaxLocation(final XMLLocator location){
    return new Location(){
        public int getColumnNumber(){
            return location.getColumnNumber();
        }

        public int getLineNumber(){
            return location.getLineNumber();
        }

        public String getPublicId(){
            return location.getPublicId();
        }

        public String getSystemId(){
            return location.getLiteralSystemId();
        }

        public int getCharacterOffset(){
            return location.getCharacterOffset();
        }
        public String getLocationURI(){
            return "";
        }

    };
}
 
Example #18
Source File: JAXPValidatorComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) throws XNIException {
    fNamespaceContext = namespaceContext;
    fContentHandler.setDocumentLocator(new LocatorProxy(locator));
    try {
        fContentHandler.startDocument();
    } catch (SAXException e) {
        throw new XNIException(e);
    }
}
 
Example #19
Source File: XIncludeHandler.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
@Override
public void startDTD(XMLLocator locator, Augmentations augmentations)
    throws XNIException {
    fInDTD = true;
    if (fDTDHandler != null) {
        fDTDHandler.startDTD(locator, augmentations);
    }
}
 
Example #20
Source File: XMLParseException.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Constructs a parse exception. */
public XMLParseException(XMLLocator locator, String message) {
    super(message);
    if (locator != null) {
        fPublicId = locator.getPublicId();
        fLiteralSystemId = locator.getLiteralSystemId();
        fExpandedSystemId = locator.getExpandedSystemId();
        fBaseSystemId = locator.getBaseSystemId();
        fLineNumber = locator.getLineNumber();
        fColumnNumber = locator.getColumnNumber();
        fCharacterOffset = locator.getCharacterOffset();
    }
}
 
Example #21
Source File: ValidatorHandlerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void startDocument(XMLLocator locator, String encoding,
        NamespaceContext namespaceContext, Augmentations augs)
        throws XNIException {
    if (fContentHandler != null) {
        try {
            fContentHandler.startDocument();
        }
        catch (SAXException e) {
            throw new XNIException(e);
        }
    }
}
 
Example #22
Source File: XMLParseException.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Constructs a parse exception. */
public XMLParseException(XMLLocator locator, String message) {
    super(message);
    if (locator != null) {
        fPublicId = locator.getPublicId();
        fLiteralSystemId = locator.getLiteralSystemId();
        fExpandedSystemId = locator.getExpandedSystemId();
        fBaseSystemId = locator.getBaseSystemId();
        fLineNumber = locator.getLineNumber();
        fColumnNumber = locator.getColumnNumber();
        fCharacterOffset = locator.getCharacterOffset();
    }
}
 
Example #23
Source File: ValidatorHandlerImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void startDocument(XMLLocator locator, String encoding,
        NamespaceContext namespaceContext, Augmentations augs)
        throws XNIException {
    if (fContentHandler != null) {
        try {
            fContentHandler.startDocument();
        }
        catch (SAXException e) {
            throw new XNIException(e);
        }
    }
}
 
Example #24
Source File: XIncludeHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks if the file indicated by the given XMLLocator has already been included
 * in the current stack.
 * @param includedSource the source to check for inclusion
 * @return true if the source has already been included
 */
protected boolean searchForRecursiveIncludes(XMLLocator includedSource) {
    String includedSystemId = includedSource.getExpandedSystemId();

    if (includedSystemId == null) {
        try {
            includedSystemId =
                XMLEntityManager.expandSystemId(
                    includedSource.getLiteralSystemId(),
                    includedSource.getBaseSystemId(),
                    false);
        }
        catch (MalformedURIException e) {
            reportFatalError("ExpandedSystemId");
        }
    }

    if (includedSystemId.equals(fCurrentBaseURI.getExpandedSystemId())) {
        return true;
    }

    if (fParentXIncludeHandler == null) {
        return false;
    }
    return fParentXIncludeHandler.searchForRecursiveIncludes(
        includedSource);
}
 
Example #25
Source File: TeeXMLDocumentFilterImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void startDocument(
    XMLLocator locator,
    String encoding,
    NamespaceContext namespaceContext,
    Augmentations augs)
    throws XNIException {
    side.startDocument(locator, encoding, namespaceContext, augs);
    next.startDocument(locator, encoding, namespaceContext, augs);
}
 
Example #26
Source File: XMLParseException.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Constructs a parse exception. */
public XMLParseException(XMLLocator locator,
                         String message, Exception exception) {
    super(message, exception);
    if (locator != null) {
        fPublicId = locator.getPublicId();
        fLiteralSystemId = locator.getLiteralSystemId();
        fExpandedSystemId = locator.getExpandedSystemId();
        fBaseSystemId = locator.getBaseSystemId();
        fLineNumber = locator.getLineNumber();
        fColumnNumber = locator.getColumnNumber();
        fCharacterOffset = locator.getCharacterOffset();
    }
}
 
Example #27
Source File: ValidatorHandlerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void startDocument(XMLLocator locator, String encoding,
        NamespaceContext namespaceContext, Augmentations augs)
        throws XNIException {
    if (fContentHandler != null) {
        try {
            fContentHandler.startDocument();
        }
        catch (SAXException e) {
            throw new XNIException(e);
        }
    }
}
 
Example #28
Source File: XMLSchemaValidator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void reportError(
    XMLLocator location,
    String domain,
    String key,
    Object[] arguments,
    short severity)
    throws XNIException {
    String message = fErrorReporter.reportError(location, domain, key, arguments, severity);
    if (fAugPSVI) {
        fErrors.add(key);
        fErrors.add(message);
    }
}
 
Example #29
Source File: TeeXMLDocumentFilterImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void startDocument(
        XMLLocator locator,
        String encoding,
        NamespaceContext namespaceContext,
        Augmentations augs)
    throws XNIException {
    side.startDocument(locator, encoding, namespaceContext, augs);
    next.startDocument(locator, encoding, namespaceContext, augs);
}
 
Example #30
Source File: UnparsedEntityHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void startDTD(XMLLocator locator, Augmentations augmentations)
        throws XNIException {
    fValidationManager.setEntityState(this);
    if (fDTDHandler != null) {
        fDTDHandler.startDTD(locator, augmentations);
    }
}