com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter. 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: SchemaValidatorConfiguration.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #2
Source File: SchemaValidatorConfiguration.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #3
Source File: SchemaValidatorConfiguration.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #4
Source File: SchemaValidatorConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #5
Source File: SchemaValidatorConfiguration.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #6
Source File: SchemaValidatorConfiguration.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #7
Source File: SchemaValidatorConfiguration.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #8
Source File: SchemaValidatorConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #9
Source File: SchemaValidatorConfiguration.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #10
Source File: SchemaValidatorConfiguration.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #11
Source File: SchemaValidatorConfiguration.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example #12
Source File: XMLGrammarCachingConfiguration.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
SchemaGrammar parseXMLSchema(XMLInputSource is)
            throws IOException {
    XMLEntityResolver resolver = getEntityResolver();
    if(resolver != null) {
        fSchemaLoader.setEntityResolver(resolver);
    }
    if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
        fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
    }
    fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter);

    String propPrefix = Constants.XERCES_PROPERTY_PREFIX;
    String propName = propPrefix + Constants.SCHEMA_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = propPrefix + Constants.SCHEMA_NONS_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING));

    // Should check whether the grammar with this namespace is already in
    // the grammar resolver. But since we don't know the target namespace
    // of the document here, we leave such check to XSDHandler
    SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is);
    // by default, hand it off to the grammar pool
    if (grammar != null) {
        fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA,
                                  new Grammar[]{grammar});
    }

    return grammar;

}
 
Example #13
Source File: CMNodeFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void nodeCountCheck(){
    if( fSecurityManager != null && !fSecurityManager.isNoLimit(maxNodeLimit) &&
            nodeCount++ > maxNodeLimit){
        if(DEBUG){
            System.out.println("nodeCount = " + nodeCount ) ;
            System.out.println("nodeLimit = " + maxNodeLimit ) ;
        }
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "maxOccurLimit", new Object[]{ new Integer(maxNodeLimit) }, XMLErrorReporter.SEVERITY_FATAL_ERROR);
        // similarly to entity manager behaviour, take into accont
        // behaviour if continue-after-fatal-error is set.
        nodeCount = 0;
    }

}
 
Example #14
Source File: SchemaDOMParser.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Character content.
 *
 * @param text   The content.
 * @param augs   Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void characters(XMLString text, Augmentations augs) throws XNIException {
    // when it's not within xs:appinfo or xs:documentation
    if (fInnerAnnotationDepth == -1 ) {
        for (int i=text.offset; i<text.offset+text.length; i++) {
            // and there is a non-whitespace character
            if (!XMLChar.isSpace(text.ch[i])) {
                // the string we saw: starting from the first non-whitespace character.
                String txt = new String(text.ch, i, text.length+text.offset-i);
                // report an error
                fErrorReporter.reportError(fLocator,
                        XSMessageFormatter.SCHEMA_DOMAIN,
                        "s4s-elt-character",
                        new Object[]{txt},
                        XMLErrorReporter.SEVERITY_ERROR);
                break;
            }
        }
        // don't call super.characters() when it's not within one of the 2
        // annotation elements: the traversers ignore them anyway. We can
        // save time/memory creating the text nodes.
    }
    // when it's within either of the 2 elements, characters are allowed
    // and we need to store them.
    else {
        schemaDOM.characters(text);
    }

}
 
Example #15
Source File: CMNodeFactory.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void nodeCountCheck(){
    if( fSecurityManager != null && !fSecurityManager.isNoLimit(maxNodeLimit) &&
            nodeCount++ > maxNodeLimit){
        if(DEBUG){
            System.out.println("nodeCount = " + nodeCount ) ;
            System.out.println("nodeLimit = " + maxNodeLimit ) ;
        }
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "MaxOccurLimit", new Object[]{ maxNodeLimit }, XMLErrorReporter.SEVERITY_FATAL_ERROR);
        // similarly to entity manager behaviour, take into accont
        // behaviour if continue-after-fatal-error is set.
        nodeCount = 0;
    }

}
 
Example #16
Source File: XMLGrammarCachingConfiguration.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
SchemaGrammar parseXMLSchema(XMLInputSource is)
            throws IOException {
    XMLEntityResolver resolver = getEntityResolver();
    if(resolver != null) {
        fSchemaLoader.setEntityResolver(resolver);
    }
    if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
        fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
    }
    fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter);

    String propPrefix = Constants.XERCES_PROPERTY_PREFIX;
    String propName = propPrefix + Constants.SCHEMA_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = propPrefix + Constants.SCHEMA_NONS_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING));

    // Should check whether the grammar with this namespace is already in
    // the grammar resolver. But since we don't know the target namespace
    // of the document here, we leave such check to XSDHandler
    SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is);
    // by default, hand it off to the grammar pool
    if (grammar != null) {
        fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA,
                                  new Grammar[]{grammar});
    }

    return grammar;

}
 
Example #17
Source File: XMLGrammarCachingConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
SchemaGrammar parseXMLSchema(XMLInputSource is)
            throws IOException {
    XMLEntityResolver resolver = getEntityResolver();
    if(resolver != null) {
        fSchemaLoader.setEntityResolver(resolver);
    }
    if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
        fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
    }
    fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter);

    String propPrefix = Constants.XERCES_PROPERTY_PREFIX;
    String propName = propPrefix + Constants.SCHEMA_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = propPrefix + Constants.SCHEMA_NONS_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING));

    // Should check whether the grammar with this namespace is already in
    // the grammar resolver. But since we don't know the target namespace
    // of the document here, we leave such check to XSDHandler
    SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is);
    // by default, hand it off to the grammar pool
    if (grammar != null) {
        fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA,
                                  new Grammar[]{grammar});
    }

    return grammar;

}
 
Example #18
Source File: SchemaDOMParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Character content.
 *
 * @param text   The content.
 * @param augs   Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void characters(XMLString text, Augmentations augs) throws XNIException {
    // when it's not within xs:appinfo or xs:documentation
    if (fInnerAnnotationDepth == -1 ) {
        for (int i=text.offset; i<text.offset+text.length; i++) {
            // and there is a non-whitespace character
            if (!XMLChar.isSpace(text.ch[i])) {
                // the string we saw: starting from the first non-whitespace character.
                String txt = new String(text.ch, i, text.length+text.offset-i);
                // report an error
                fErrorReporter.reportError(fLocator,
                        XSMessageFormatter.SCHEMA_DOMAIN,
                        "s4s-elt-character",
                        new Object[]{txt},
                        XMLErrorReporter.SEVERITY_ERROR);
                break;
            }
        }
        // don't call super.characters() when it's not within one of the 2
        // annotation elements: the traversers ignore them anyway. We can
        // save time/memory creating the text nodes.
    }
    // when it's within either of the 2 elements, characters are allowed
    // and we need to store them.
    else {
        schemaDOM.characters(text);
    }

}
 
Example #19
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void reportSchemaErr(String key, Object[] args, Element ele, short type, Exception exception) {
    if (element2Locator(ele, xl)) {
        fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN,
                key, args, type, exception);
    }
    else {
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
                key, args, type, exception);
    }
}
 
Example #20
Source File: SchemaDOMParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Character content.
 *
 * @param text   The content.
 * @param augs   Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void characters(XMLString text, Augmentations augs) throws XNIException {
    // when it's not within xs:appinfo or xs:documentation
    if (fInnerAnnotationDepth == -1 ) {
        for (int i=text.offset; i<text.offset+text.length; i++) {
            // and there is a non-whitespace character
            if (!XMLChar.isSpace(text.ch[i])) {
                // the string we saw: starting from the first non-whitespace character.
                String txt = new String(text.ch, i, text.length+text.offset-i);
                // report an error
                fErrorReporter.reportError(fLocator,
                        XSMessageFormatter.SCHEMA_DOMAIN,
                        "s4s-elt-character",
                        new Object[]{txt},
                        XMLErrorReporter.SEVERITY_ERROR);
                break;
            }
        }
        // don't call super.characters() when it's not within one of the 2
        // annotation elements: the traversers ignore them anyway. We can
        // save time/memory creating the text nodes.
    }
    // when it's within either of the 2 elements, characters are allowed
    // and we need to store them.
    else {
        schemaDOM.characters(text);
    }

}
 
Example #21
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void reportSchemaErr(String key, Object[] args, Element ele, short type, Exception exception) {
    if (element2Locator(ele, xl)) {
        fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN,
                key, args, type, exception);
    }
    else {
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
                key, args, type, exception);
    }
}
 
Example #22
Source File: CMNodeFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void nodeCountCheck(){
    if( fSecurityManager != null && !fSecurityManager.isNoLimit(maxNodeLimit) &&
            nodeCount++ > maxNodeLimit){
        if(DEBUG){
            System.out.println("nodeCount = " + nodeCount ) ;
            System.out.println("nodeLimit = " + maxNodeLimit ) ;
        }
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "MaxOccurLimit", new Object[]{ new Integer(maxNodeLimit) }, XMLErrorReporter.SEVERITY_FATAL_ERROR);
        // similarly to entity manager behaviour, take into accont
        // behaviour if continue-after-fatal-error is set.
        nodeCount = 0;
    }

}
 
Example #23
Source File: SchemaDOMParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Character content.
 *
 * @param text   The content.
 * @param augs   Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void characters(XMLString text, Augmentations augs) throws XNIException {
    // when it's not within xs:appinfo or xs:documentation
    if (fInnerAnnotationDepth == -1 ) {
        for (int i=text.offset; i<text.offset+text.length; i++) {
            // and there is a non-whitespace character
            if (!XMLChar.isSpace(text.ch[i])) {
                // the string we saw: starting from the first non-whitespace character.
                String txt = new String(text.ch, i, text.length+text.offset-i);
                // report an error
                fErrorReporter.reportError(fLocator,
                        XSMessageFormatter.SCHEMA_DOMAIN,
                        "s4s-elt-character",
                        new Object[]{txt},
                        XMLErrorReporter.SEVERITY_ERROR);
                break;
            }
        }
        // don't call super.characters() when it's not within one of the 2
        // annotation elements: the traversers ignore them anyway. We can
        // save time/memory creating the text nodes.
    }
    // when it's within either of the 2 elements, characters are allowed
    // and we need to store them.
    else {
        schemaDOM.characters(text);
    }

}
 
Example #24
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void reportSchemaErr(String key, Object[] args, Element ele, short type, Exception exception) {
    if (element2Locator(ele, xl)) {
        fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN,
                key, args, type, exception);
    }
    else {
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
                key, args, type, exception);
    }
}
 
Example #25
Source File: SchemaDOMParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Character content.
 *
 * @param text   The content.
 * @param augs   Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void characters(XMLString text, Augmentations augs) throws XNIException {
    // when it's not within xs:appinfo or xs:documentation
    if (fInnerAnnotationDepth == -1 ) {
        for (int i=text.offset; i<text.offset+text.length; i++) {
            // and there is a non-whitespace character
            if (!XMLChar.isSpace(text.ch[i])) {
                // the string we saw: starting from the first non-whitespace character.
                String txt = new String(text.ch, i, text.length+text.offset-i);
                // report an error
                fErrorReporter.reportError(fLocator,
                        XSMessageFormatter.SCHEMA_DOMAIN,
                        "s4s-elt-character",
                        new Object[]{txt},
                        XMLErrorReporter.SEVERITY_ERROR);
                break;
            }
        }
        // don't call super.characters() when it's not within one of the 2
        // annotation elements: the traversers ignore them anyway. We can
        // save time/memory creating the text nodes.
    }
    // when it's within either of the 2 elements, characters are allowed
    // and we need to store them.
    else {
        schemaDOM.characters(text);
    }

}
 
Example #26
Source File: CMNodeFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void nodeCountCheck(){
    if( fSecurityManager != null && !fSecurityManager.isNoLimit(maxNodeLimit) &&
            nodeCount++ > maxNodeLimit){
        if(DEBUG){
            System.out.println("nodeCount = " + nodeCount ) ;
            System.out.println("nodeLimit = " + maxNodeLimit ) ;
        }
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "MaxOccurLimit", new Object[]{ new Integer(maxNodeLimit) }, XMLErrorReporter.SEVERITY_FATAL_ERROR);
        // similarly to entity manager behaviour, take into accont
        // behaviour if continue-after-fatal-error is set.
        nodeCount = 0;
    }

}
 
Example #27
Source File: XMLGrammarCachingConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
SchemaGrammar parseXMLSchema(XMLInputSource is)
            throws IOException {
    XMLEntityResolver resolver = getEntityResolver();
    if(resolver != null) {
        fSchemaLoader.setEntityResolver(resolver);
    }
    if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
        fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
    }
    fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter);

    String propPrefix = Constants.XERCES_PROPERTY_PREFIX;
    String propName = propPrefix + Constants.SCHEMA_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = propPrefix + Constants.SCHEMA_NONS_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING));

    // Should check whether the grammar with this namespace is already in
    // the grammar resolver. But since we don't know the target namespace
    // of the document here, we leave such check to XSDHandler
    SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is);
    // by default, hand it off to the grammar pool
    if (grammar != null) {
        fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA,
                                  new Grammar[]{grammar});
    }

    return grammar;

}
 
Example #28
Source File: XMLGrammarCachingConfiguration.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
SchemaGrammar parseXMLSchema(XMLInputSource is)
            throws IOException {
    XMLEntityResolver resolver = getEntityResolver();
    if(resolver != null) {
        fSchemaLoader.setEntityResolver(resolver);
    }
    if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
        fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
    }
    fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter);

    String propPrefix = Constants.XERCES_PROPERTY_PREFIX;
    String propName = propPrefix + Constants.SCHEMA_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = propPrefix + Constants.SCHEMA_NONS_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING));

    // Should check whether the grammar with this namespace is already in
    // the grammar resolver. But since we don't know the target namespace
    // of the document here, we leave such check to XSDHandler
    SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is);
    // by default, hand it off to the grammar pool
    if (grammar != null) {
        fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA,
                                  new Grammar[]{grammar});
    }

    return grammar;

}
 
Example #29
Source File: CMNodeFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void nodeCountCheck(){
    if( fSecurityManager != null && !fSecurityManager.isNoLimit(maxNodeLimit) &&
            nodeCount++ > maxNodeLimit){
        if(DEBUG){
            System.out.println("nodeCount = " + nodeCount ) ;
            System.out.println("nodeLimit = " + maxNodeLimit ) ;
        }
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "maxOccurLimit", new Object[]{ new Integer(maxNodeLimit) }, XMLErrorReporter.SEVERITY_FATAL_ERROR);
        // similarly to entity manager behaviour, take into accont
        // behaviour if continue-after-fatal-error is set.
        nodeCount = 0;
    }

}
 
Example #30
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void reportSchemaErr(String key, Object[] args, Element ele, short type, Exception exception) {
    if (element2Locator(ele, xl)) {
        fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN,
                key, args, type, exception);
    }
    else {
        fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
                key, args, type, exception);
    }
}