Java Code Examples for com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource#getPublicId()

The following examples show how to use com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource#getPublicId() . 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: XMLDocumentScannerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 2
Source File: XMLDocumentScannerImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 3
Source File: XMLDocumentScannerImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 4
Source File: XMLDocumentScannerImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 5
Source File: XMLDocumentScannerImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 6
Source File: XMLDocumentScannerImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 7
Source File: XMLDocumentScannerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 8
Source File: XMLDocumentScannerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 9
Source File: XMLDocumentScannerImpl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {

    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);

    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            fDTDScanner.setInputSource(src);
            while (fDTDScanner.scanDTDExternalSubset(true));
        } finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
        }
    }
}
 
Example 10
Source File: XMLDTDLoader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 11
Source File: XMLDTDLoader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 12
Source File: XMLDTDLoader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 13
Source File: XMLDTDLoader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 14
Source File: XMLDTDLoader.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 15
Source File: XMLDTDLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 16
Source File: XMLDTDLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 17
Source File: XMLDTDLoader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 18
Source File: XMLDTDLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 19
Source File: XMLDTDLoader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}
 
Example 20
Source File: XMLDTDLoader.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a Grammar object by parsing the contents of the
 * entity pointed to by source.
 *
 * @param source        the location of the entity which forms
 *                          the starting point of the grammar to be constructed.
 * @throws IOException      When a problem is encountered reading the entity
 *          XNIException    When a condition arises (such as a FatalError) that requires parsing
 *                              of the entity be terminated.
 */
public Grammar loadGrammar(XMLInputSource source)
        throws IOException, XNIException {
    reset();
    // First chance checking strict URI
    String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
    XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
    if (!fBalanceSyntaxTrees) {
        fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
    }
    else {
        fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
    }
    fGrammarBucket = new DTDGrammarBucket();
    fGrammarBucket.setStandalone(false);
    fGrammarBucket.setActiveGrammar(fDTDGrammar);
    // no reason to use grammar bucket's "put" method--we
    // know which grammar it is, and we don't know the root name anyway...

    // actually start the parsing!
    try {
        fDTDScanner.setInputSource(source);
        fDTDScanner.scanDTDExternalSubset(true);
    } catch (EOFException e) {
        // expected behaviour...
    }
    finally {
        // Close all streams opened by the parser.
        fEntityManager.closeReaders();
    }
    if(fDTDGrammar != null && fGrammarPool != null) {
        fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
    }
    return fDTDGrammar;
}