Java Code Examples for com.sun.xml.internal.xsom.parser.XSOMParser#setEntityResolver()

The following examples show how to use com.sun.xml.internal.xsom.parser.XSOMParser#setEntityResolver() . 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: ModelLoader.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public XSOMParser createXSOMParser(final DOMForest forest) {
    XSOMParser p = createXSOMParser(forest.createParser());
    p.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            // DOMForest only parses documents that are reachable through systemIds,
            // and it won't pick up references like <xs:import namespace="..." /> without
            // @schemaLocation. So we still need to use an entity resolver here to resolve
            // these references, yet we don't want to just run them blindly, since if we do that
            // DOMForestParser always get the translated system ID when catalog is used
            // (where DOMForest records trees with their original system IDs.)
            if(systemId!=null && forest.get(systemId)!=null)
                return new InputSource(systemId);
            if(opt.entityResolver!=null)
                return opt.entityResolver.resolveEntity(publicId,systemId);

            return null;
        }
    });
    return p;
}
 
Example 2
Source File: ModelLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public XSOMParser createXSOMParser(final DOMForest forest) {
    XSOMParser p = createXSOMParser(forest.createParser());
    p.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            // DOMForest only parses documents that are reachable through systemIds,
            // and it won't pick up references like <xs:import namespace="..." /> without
            // @schemaLocation. So we still need to use an entity resolver here to resolve
            // these references, yet we don't want to just run them blindly, since if we do that
            // DOMForestParser always get the translated system ID when catalog is used
            // (where DOMForest records trees with their original system IDs.)
            if(systemId!=null && forest.get(systemId)!=null)
                return new InputSource(systemId);
            if(opt.entityResolver!=null)
                return opt.entityResolver.resolveEntity(publicId,systemId);

            return null;
        }
    });
    return p;
}
 
Example 3
Source File: ModelLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public XSOMParser createXSOMParser(final DOMForest forest) {
    XSOMParser p = createXSOMParser(forest.createParser());
    p.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            // DOMForest only parses documents that are reachable through systemIds,
            // and it won't pick up references like <xs:import namespace="..." /> without
            // @schemaLocation. So we still need to use an entity resolver here to resolve
            // these references, yet we don't want to just run them blindly, since if we do that
            // DOMForestParser always get the translated system ID when catalog is used
            // (where DOMForest records trees with their original system IDs.)
            if(systemId!=null && forest.get(systemId)!=null)
                return new InputSource(systemId);
            if(opt.entityResolver!=null)
                return opt.entityResolver.resolveEntity(publicId,systemId);

            return null;
        }
    });
    return p;
}
 
Example 4
Source File: ModelLoader.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public XSOMParser createXSOMParser(final DOMForest forest) {
    XSOMParser p = createXSOMParser(forest.createParser());
    p.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            // DOMForest only parses documents that are reachable through systemIds,
            // and it won't pick up references like <xs:import namespace="..." /> without
            // @schemaLocation. So we still need to use an entity resolver here to resolve
            // these references, yet we don't want to just run them blindly, since if we do that
            // DOMForestParser always get the translated system ID when catalog is used
            // (where DOMForest records trees with their original system IDs.)
            if(systemId!=null && forest.get(systemId)!=null)
                return new InputSource(systemId);
            if(opt.entityResolver!=null)
                return opt.entityResolver.resolveEntity(publicId,systemId);

            return null;
        }
    });
    return p;
}
 
Example 5
Source File: ModelLoader.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public XSOMParser createXSOMParser(final DOMForest forest) {
    XSOMParser p = createXSOMParser(forest.createParser());
    p.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            // DOMForest only parses documents that are reachable through systemIds,
            // and it won't pick up references like <xs:import namespace="..." /> without
            // @schemaLocation. So we still need to use an entity resolver here to resolve
            // these references, yet we don't want to just run them blindly, since if we do that
            // DOMForestParser always get the translated system ID when catalog is used
            // (where DOMForest records trees with their original system IDs.)
            if(systemId!=null && forest.get(systemId)!=null)
                return new InputSource(systemId);
            if(opt.entityResolver!=null)
                return opt.entityResolver.resolveEntity(publicId,systemId);

            return null;
        }
    });
    return p;
}
 
Example 6
Source File: ModelLoader.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public XSOMParser createXSOMParser(final DOMForest forest) {
    XSOMParser p = createXSOMParser(forest.createParser());
    p.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            // DOMForest only parses documents that are reachable through systemIds,
            // and it won't pick up references like <xs:import namespace="..." /> without
            // @schemaLocation. So we still need to use an entity resolver here to resolve
            // these references, yet we don't want to just run them blindly, since if we do that
            // DOMForestParser always get the translated system ID when catalog is used
            // (where DOMForest records trees with their original system IDs.)
            if(systemId!=null && forest.get(systemId)!=null)
                return new InputSource(systemId);
            if(opt.entityResolver!=null)
                return opt.entityResolver.resolveEntity(publicId,systemId);

            return null;
        }
    });
    return p;
}
 
Example 7
Source File: ModelLoader.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public XSOMParser createXSOMParser(final DOMForest forest) {
    XSOMParser p = createXSOMParser(forest.createParser());
    p.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            // DOMForest only parses documents that are reachable through systemIds,
            // and it won't pick up references like <xs:import namespace="..." /> without
            // @schemaLocation. So we still need to use an entity resolver here to resolve
            // these references, yet we don't want to just run them blindly, since if we do that
            // DOMForestParser always get the translated system ID when catalog is used
            // (where DOMForest records trees with their original system IDs.)
            if(systemId!=null && forest.get(systemId)!=null)
                return new InputSource(systemId);
            if(opt.entityResolver!=null)
                return opt.entityResolver.resolveEntity(publicId,systemId);

            return null;
        }
    });
    return p;
}
 
Example 8
Source File: ModelLoader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Potentially problematic - make sure the parser instance passed is initialized
 * with proper security feature.
 *
 * @param parser
 * @return
 */
public XSOMParser createXSOMParser(XMLParser parser) {
    // set up other parameters to XSOMParser
    XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
    reader.setErrorHandler(errorReceiver);
    reader.setEntityResolver(opt.entityResolver);
    return reader;
}
 
Example 9
Source File: ModelLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Potentially problematic - make sure the parser instance passed is initialized
 * with proper security feature.
 *
 * @param parser
 * @return
 */
public XSOMParser createXSOMParser(XMLParser parser) {
    // set up other parameters to XSOMParser
    XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
    reader.setErrorHandler(errorReceiver);
    reader.setEntityResolver(opt.entityResolver);
    return reader;
}
 
Example 10
Source File: ModelLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public XSOMParser createXSOMParser(final DOMForest forest) {
    XSOMParser p = createXSOMParser(forest.createParser());
    p.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            // DOMForest only parses documents that are reachable through systemIds,
            // and it won't pick up references like <xs:import namespace="..." /> without
            // @schemaLocation. So we still need to use an entity resolver here to resolve
            // these references, yet we don't want to just run them blindly, since if we do that
            // DOMForestParser always get the translated system ID when catalog is used
            // (where DOMForest records trees with their original system IDs.)
            if(systemId!=null && forest.get(systemId)!=null)
                return new InputSource(systemId);
            if(opt.entityResolver!=null)
                return opt.entityResolver.resolveEntity(publicId,systemId);

            return null;
        }
    });
    return p;
}
 
Example 11
Source File: ModelLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Potentially problematic - make sure the parser instance passed is initialized
 * with proper security feature.
 *
 * @param parser
 * @return
 */
public XSOMParser createXSOMParser(XMLParser parser) {
    // set up other parameters to XSOMParser
    XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
    reader.setErrorHandler(errorReceiver);
    reader.setEntityResolver(opt.entityResolver);
    return reader;
}
 
Example 12
Source File: ModelLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Potentially problematic - make sure the parser instance passed is initialized
 * with proper security feature.
 *
 * @param parser
 * @return
 */
public XSOMParser createXSOMParser(XMLParser parser) {
    // set up other parameters to XSOMParser
    XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
    reader.setErrorHandler(errorReceiver);
    reader.setEntityResolver(opt.entityResolver);
    return reader;
}
 
Example 13
Source File: ModelLoader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Potentially problematic - make sure the parser instance passed is initialized
 * with proper security feature.
 *
 * @param parser
 * @return
 */
public XSOMParser createXSOMParser(XMLParser parser) {
    // set up other parameters to XSOMParser
    XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
    reader.setErrorHandler(errorReceiver);
    reader.setEntityResolver(opt.entityResolver);
    return reader;
}
 
Example 14
Source File: ModelLoader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Potentially problematic - make sure the parser instance passed is initialized
 * with proper security feature.
 *
 * @param parser
 * @return
 */
public XSOMParser createXSOMParser(XMLParser parser) {
    // set up other parameters to XSOMParser
    XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
    reader.setErrorHandler(errorReceiver);
    reader.setEntityResolver(opt.entityResolver);
    return reader;
}
 
Example 15
Source File: ModelLoader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Potentially problematic - make sure the parser instance passed is initialized
 * with proper security feature.
 *
 * @param parser
 * @return
 */
public XSOMParser createXSOMParser(XMLParser parser) {
    // set up other parameters to XSOMParser
    XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
    reader.setErrorHandler(errorReceiver);
    reader.setEntityResolver(opt.entityResolver);
    return reader;
}
 
Example 16
Source File: ModelLoader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Potentially problematic - make sure the parser instance passed is initialized
 * with proper security feature.
 *
 * @param parser
 * @return
 */
public XSOMParser createXSOMParser(XMLParser parser) {
    // set up other parameters to XSOMParser
    XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
    reader.setErrorHandler(errorReceiver);
    reader.setEntityResolver(opt.entityResolver);
    return reader;
}