com.sun.org.apache.xerces.internal.xni.grammars.XMLDTDDescription Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.xni.grammars.XMLDTDDescription. 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: EntityResolver2Wrapper.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #2
Source File: EntityResolver2Wrapper.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #3
Source File: EntityResolver2Wrapper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #4
Source File: EntityResolver2Wrapper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #5
Source File: EntityResolver2Wrapper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #6
Source File: EntityResolver2Wrapper.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #7
Source File: EntityResolver2Wrapper.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #8
Source File: EntityResolver2Wrapper.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #9
Source File: EntityResolver2Wrapper.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #10
Source File: EntityResolver2Wrapper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #11
Source File: EntityResolver2Wrapper.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String name = grammarDescription.getRootName();
        String baseURI = grammarDescription.getBaseSystemId();

        // Resolve using EntityResolver2
        try {
            InputSource inputSource = fEntityResolver.getExternalSubset(name, baseURI);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving external subset
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve external subset
    return null;

}
 
Example #12
Source File: EntityResolver2Wrapper.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #13
Source File: EntityResolver2Wrapper.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #14
Source File: EntityResolver2Wrapper.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #15
Source File: EntityResolver2Wrapper.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #16
Source File: EntityResolver2Wrapper.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #17
Source File: EntityResolver2Wrapper.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #18
Source File: EntityResolver2Wrapper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #19
Source File: EntityResolver2Wrapper.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #20
Source File: EntityResolver2Wrapper.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #21
Source File: EntityResolver2Wrapper.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #22
Source File: EntityResolver2Wrapper.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
        throws XNIException, IOException {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // When both pubId and sysId are null, the user's entity resolver
        // can do nothing about it. We'd better not bother calling it.
        // This happens when the resourceIdentifier is a GrammarDescription,
        // which describes a schema grammar of some namespace, but without
        // any schema location hint. -Sg
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
Example #23
Source File: ExternalSubsetResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
    throws XNIException, IOException;
 
Example #24
Source File: ExternalSubsetResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
    throws XNIException, IOException;
 
Example #25
Source File: ExternalSubsetResolver.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
    throws XNIException, IOException;
 
Example #26
Source File: ExternalSubsetResolver.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
    throws XNIException, IOException;
 
Example #27
Source File: ExternalSubsetResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
    throws XNIException, IOException;
 
Example #28
Source File: ExternalSubsetResolver.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
    throws XNIException, IOException;
 
Example #29
Source File: ExternalSubsetResolver.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
    throws XNIException, IOException;
 
Example #30
Source File: ExternalSubsetResolver.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Locates an external subset for documents which do not explicitly
 * provide one. If no external subset is provided, this method should
 * return <code>null</code>.</p>
 *
 * @param grammarDescription a description of the DTD
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource getExternalSubset(XMLDTDDescription grammarDescription)
    throws XNIException, IOException;