com.sun.org.apache.xerces.internal.dom.AbortException Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.dom.AbortException. 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: DOMNormalizer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports a DOM error to the user handler.
 *
 * If the error is fatal, the processing will be always aborted.
 */
public static final void reportDOMError(DOMErrorHandler errorHandler, DOMErrorImpl error, DOMLocatorImpl locator,
                    String message, short severity, String type ) {
    if( errorHandler!=null ) {
        error.reset();
        error.fMessage = message;
        error.fSeverity = severity;
        error.fLocator = locator;
        error.fType = type;
        error.fRelatedData = locator.fRelatedNode;

        if(!errorHandler.handleError(error))
            throw new AbortException();
    }
    if( severity==DOMError.SEVERITY_FATAL_ERROR )
        throw new AbortException();
}
 
Example #2
Source File: DOMNormalizer.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Reports a DOM error to the user handler.
 *
 * If the error is fatal, the processing will be always aborted.
 */
public static final void reportDOMError(DOMErrorHandler errorHandler, DOMErrorImpl error, DOMLocatorImpl locator,
                    String message, short severity, String type ) {
    if( errorHandler!=null ) {
        error.reset();
        error.fMessage = message;
        error.fSeverity = severity;
        error.fLocator = locator;
        error.fType = type;
        error.fRelatedData = locator.fRelatedNode;

        if(!errorHandler.handleError(error))
            throw new AbortException();
    }
    if( severity==DOMError.SEVERITY_FATAL_ERROR )
        throw new AbortException();
}
 
Example #3
Source File: DOMNormalizer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports a DOM error to the user handler.
 *
 * If the error is fatal, the processing will be always aborted.
 */
public static final void reportDOMError(DOMErrorHandler errorHandler, DOMErrorImpl error, DOMLocatorImpl locator,
                    String message, short severity, String type ) {
    if( errorHandler!=null ) {
        error.reset();
        error.fMessage = message;
        error.fSeverity = severity;
        error.fLocator = locator;
        error.fType = type;
        error.fRelatedData = locator.fRelatedNode;

        if(!errorHandler.handleError(error))
            throw new AbortException();
    }
    if( severity==DOMError.SEVERITY_FATAL_ERROR )
        throw new AbortException();
}
 
Example #4
Source File: DOMNormalizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports a DOM error to the user handler.
 *
 * If the error is fatal, the processing will be always aborted.
 */
public static final void reportDOMError(DOMErrorHandler errorHandler, DOMErrorImpl error, DOMLocatorImpl locator,
                    String message, short severity, String type ) {
    if( errorHandler!=null ) {
        error.reset();
        error.fMessage = message;
        error.fSeverity = severity;
        error.fLocator = locator;
        error.fType = type;
        error.fRelatedData = locator.fRelatedNode;

        if(!errorHandler.handleError(error))
            throw new AbortException();
    }
    if( severity==DOMError.SEVERITY_FATAL_ERROR )
        throw new AbortException();
}
 
Example #5
Source File: DOMNormalizer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports a DOM error to the user handler.
 *
 * If the error is fatal, the processing will be always aborted.
 */
public static final void reportDOMError(DOMErrorHandler errorHandler, DOMErrorImpl error, DOMLocatorImpl locator,
                    String message, short severity, String type ) {
    if( errorHandler!=null ) {
        error.reset();
        error.fMessage = message;
        error.fSeverity = severity;
        error.fLocator = locator;
        error.fType = type;
        error.fRelatedData = locator.fRelatedNode;

        if(!errorHandler.handleError(error))
            throw new AbortException();
    }
    if( severity==DOMError.SEVERITY_FATAL_ERROR )
        throw new AbortException();
}
 
Example #6
Source File: DOMNormalizer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
* Normalizes document.
* Note: reset() must be called before this method.
*/
   protected void normalizeDocument(CoreDocumentImpl document, DOMConfigurationImpl config) {

           fDocument = document;
           fConfiguration = config;

           // intialize and reset DOMNormalizer component
           //
           fSymbolTable = (SymbolTable) fConfiguration.getProperty(DOMConfigurationImpl.SYMBOL_TABLE);
           // reset namespace context
           fNamespaceContext.reset();
           fNamespaceContext.declarePrefix(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);

           if ((fConfiguration.features & DOMConfigurationImpl.VALIDATE) != 0) {
       String schemaLang = (String)fConfiguration.getProperty(DOMConfigurationImpl.JAXP_SCHEMA_LANGUAGE);

       if(schemaLang != null && schemaLang.equals(Constants.NS_XMLSCHEMA)) {
                   fValidationHandler =
                           CoreDOMImplementationImpl.singleton.getValidator(XMLGrammarDescription.XML_SCHEMA);
           fConfiguration.setFeature(DOMConfigurationImpl.SCHEMA, true);
           fConfiguration.setFeature(DOMConfigurationImpl.SCHEMA_FULL_CHECKING, true);
           // report fatal error on DOM Level 1 nodes
           fNamespaceValidation = true;

           // check if we need to fill in PSVI
           fPSVI = ((fConfiguration.features & DOMConfigurationImpl.PSVI) !=0)?true:false;
       }

                   fConfiguration.setFeature(DOMConfigurationImpl.XERCES_VALIDATION, true);

       // reset ID table
       fDocument.clearIdentifiers();

       if(fValidationHandler != null)
       // reset schema validator
           ((XMLComponent) fValidationHandler).reset(fConfiguration);

           }

           fErrorHandler = (DOMErrorHandler) fConfiguration.getParameter(Constants.DOM_ERROR_HANDLER);
           if (fValidationHandler != null) {
                   fValidationHandler.setDocumentHandler(this);
                   fValidationHandler.startDocument(
               new SimpleLocator(fDocument.fDocumentURI, fDocument.fDocumentURI,
                                           -1, -1 ), fDocument.encoding, fNamespaceContext, null);

           }
           try {
                   Node kid, next;
                   for (kid = fDocument.getFirstChild(); kid != null; kid = next) {
                           next = kid.getNextSibling();
                           kid = normalizeNode(kid);
                           if (kid != null) { // don't advance
                                   next = kid;
                           }
                   }

                   // release resources
                   if (fValidationHandler != null) {
                           fValidationHandler.endDocument(null);
                           CoreDOMImplementationImpl.singleton.releaseValidator(
                                   XMLGrammarDescription.XML_SCHEMA, fValidationHandler);
                           fValidationHandler = null;
                   }
           } catch (AbortException e) {
               return;
           }

   }