com.sun.org.apache.xerces.internal.dom.DOMErrorImpl Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.dom.DOMErrorImpl.
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: XMLSchemaLoader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #2
Source File: XMLSchemaLoader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #3
Source File: XMLSchemaLoader.java From Bytecoder with Apache License 2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #4
Source File: XMLSchemaLoader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #5
Source File: XMLSchemaLoader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #6
Source File: XMLSchemaLoader.java From JDKSourceCode1.8 with MIT License | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #7
Source File: XMLSchemaLoader.java From hottub with GNU General Public License v2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #8
Source File: XMLSchemaLoader.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #9
Source File: XMLSchemaLoader.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #10
Source File: XMLSchemaLoader.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #11
Source File: XMLSchemaLoader.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
void reportDOMFatalError(Exception e) { if (fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl(); error.fException = e; error.fMessage = e.getMessage(); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError(error); } }
Example #12
Source File: AbstractDOMParser.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Record baseURI information for the Element (by adding xml:base attribute) * or for the ProcessingInstruction (by setting a baseURI field) * Non deferred DOM. * * @param node */ protected final void handleBaseURI (Node node){ if (fDocumentImpl != null) { // REVISIT: remove dependency on our implementation when // DOM L3 becomes REC String baseURI = null; short nodeType = node.getNodeType (); if (nodeType == Node.ELEMENT_NODE) { // if an element already has xml:base attribute // do nothing if (fNamespaceAware) { if (((Element)node).getAttributeNodeNS ("http://www.w3.org/XML/1998/namespace","base")!=null) { return; } } else if (((Element)node).getAttributeNode ("xml:base") != null) { return; } // retrive the baseURI from the entity reference baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && !baseURI.equals (fDocumentImpl.getDocumentURI ())) { if (fNamespaceAware) { ((Element)node).setAttributeNS ("http://www.w3.org/XML/1998/namespace", "xml:base", baseURI); } else { ((Element)node).setAttribute ("xml:base", baseURI); } } } else if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) { baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fType = "pi-base-uri-not-preserved"; error.fRelatedData = baseURI; error.fSeverity = DOMError.SEVERITY_WARNING; fErrorHandler.getErrorHandler ().handleError (error); } } } }
Example #13
Source File: DOMParserImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Parse an XML document from a resource identified by an * <code>LSInput</code>. * */ public Document parse (LSInput is) throws LSException { // need to wrap the LSInput with an XMLInputSource XMLInputSource xmlInputSource = dom2xmlInputSource (is); if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } try { currentThread = Thread.currentThread(); fBusy = true; parse (xmlInputSource); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e) { fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #14
Source File: DOMParserImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a resource identified by an * <code>LSInput</code>. * */ public Document parse (LSInput is) throws LSException { // need to wrap the LSInput with an XMLInputSource XMLInputSource xmlInputSource = dom2xmlInputSource (is); if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } try { currentThread = Thread.currentThread(); fBusy = true; parse (xmlInputSource); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e) { fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #15
Source File: DOMParserImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a resource identified by an * <code>LSInput</code>. * */ public Document parse (LSInput is) throws LSException { // need to wrap the LSInput with an XMLInputSource XMLInputSource xmlInputSource = dom2xmlInputSource (is); if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } try { currentThread = Thread.currentThread(); fBusy = true; parse (xmlInputSource); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e) { fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #16
Source File: AbstractDOMParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Record baseURI information for the Element (by adding xml:base attribute) * or for the ProcessingInstruction (by setting a baseURI field) * Non deferred DOM. * * @param node */ protected final void handleBaseURI (Node node){ if (fDocumentImpl != null) { // REVISIT: remove dependency on our implementation when // DOM L3 becomes REC String baseURI = null; short nodeType = node.getNodeType (); if (nodeType == Node.ELEMENT_NODE) { // if an element already has xml:base attribute // do nothing if (fNamespaceAware) { if (((Element)node).getAttributeNodeNS ("http://www.w3.org/XML/1998/namespace","base")!=null) { return; } } else if (((Element)node).getAttributeNode ("xml:base") != null) { return; } // retrive the baseURI from the entity reference baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && !baseURI.equals (fDocumentImpl.getDocumentURI ())) { if (fNamespaceAware) { ((Element)node).setAttributeNS ("http://www.w3.org/XML/1998/namespace", "xml:base", baseURI); } else { ((Element)node).setAttribute ("xml:base", baseURI); } } } else if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) { baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fType = "pi-base-uri-not-preserved"; error.fRelatedData = baseURI; error.fSeverity = DOMError.SEVERITY_WARNING; fErrorHandler.getErrorHandler ().handleError (error); } } } }
Example #17
Source File: DOMParserImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a location identified by an URI reference. * If the URI contains a fragment identifier (see section 4.1 in ), the * behavior is not defined by this specification. * */ public Document parseURI (String uri) throws LSException { //If DOMParser insstance is already busy parsing another document when this // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } XMLInputSource source = new XMLInputSource (null, uri, null, false); try { currentThread = Thread.currentThread(); fBusy = true; parse (source); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e){ fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler ().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #18
Source File: DOMParserImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a resource identified by an * <code>LSInput</code>. * */ public Document parse (LSInput is) throws LSException { // need to wrap the LSInput with an XMLInputSource XMLInputSource xmlInputSource = dom2xmlInputSource (is); if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } try { currentThread = Thread.currentThread(); fBusy = true; parse (xmlInputSource); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e) { fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #19
Source File: DOMParserImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a location identified by an URI reference. * If the URI contains a fragment identifier (see section 4.1 in ), the * behavior is not defined by this specification. * */ public Document parseURI (String uri) throws LSException { //If DOMParser insstance is already busy parsing another document when this // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } XMLInputSource source = new XMLInputSource (null, uri, null); try { currentThread = Thread.currentThread(); fBusy = true; parse (source); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e){ fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler ().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #20
Source File: DOMParserImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a resource identified by an * <code>LSInput</code>. * */ public Document parse (LSInput is) throws LSException { // need to wrap the LSInput with an XMLInputSource XMLInputSource xmlInputSource = dom2xmlInputSource (is); if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } try { currentThread = Thread.currentThread(); fBusy = true; parse (xmlInputSource); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e) { fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #21
Source File: AbstractDOMParser.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Record baseURI information for the Element (by adding xml:base attribute) * or for the ProcessingInstruction (by setting a baseURI field) * Non deferred DOM. * * @param node */ protected final void handleBaseURI (Node node){ if (fDocumentImpl != null) { // REVISIT: remove dependency on our implementation when // DOM L3 becomes REC String baseURI = null; short nodeType = node.getNodeType (); if (nodeType == Node.ELEMENT_NODE) { // if an element already has xml:base attribute // do nothing if (fNamespaceAware) { if (((Element)node).getAttributeNodeNS ("http://www.w3.org/XML/1998/namespace","base")!=null) { return; } } else if (((Element)node).getAttributeNode ("xml:base") != null) { return; } // retrive the baseURI from the entity reference baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && !baseURI.equals (fDocumentImpl.getDocumentURI ())) { if (fNamespaceAware) { ((Element)node).setAttributeNS ("http://www.w3.org/XML/1998/namespace", "xml:base", baseURI); } else { ((Element)node).setAttribute ("xml:base", baseURI); } } } else if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) { baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fType = "pi-base-uri-not-preserved"; error.fRelatedData = baseURI; error.fSeverity = DOMError.SEVERITY_WARNING; fErrorHandler.getErrorHandler ().handleError (error); } } } }
Example #22
Source File: DOMParserImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a location identified by an URI reference. * If the URI contains a fragment identifier (see section 4.1 in ), the * behavior is not defined by this specification. * */ public Document parseURI (String uri) throws LSException { //If DOMParser insstance is already busy parsing another document when this // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } XMLInputSource source = new XMLInputSource (null, uri, null); try { currentThread = Thread.currentThread(); fBusy = true; parse (source); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e){ fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler ().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #23
Source File: DOMParserImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a resource identified by an * <code>LSInput</code>. * */ public Document parse (LSInput is) throws LSException { // need to wrap the LSInput with an XMLInputSource XMLInputSource xmlInputSource = dom2xmlInputSource (is); if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } try { currentThread = Thread.currentThread(); fBusy = true; parse (xmlInputSource); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e) { fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #24
Source File: AbstractDOMParser.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Record baseURI information for the Element (by adding xml:base attribute) * or for the ProcessingInstruction (by setting a baseURI field) * Non deferred DOM. * * @param node */ protected final void handleBaseURI (Node node){ if (fDocumentImpl != null) { // REVISIT: remove dependency on our implementation when // DOM L3 becomes REC String baseURI = null; short nodeType = node.getNodeType (); if (nodeType == Node.ELEMENT_NODE) { // if an element already has xml:base attribute // do nothing if (fNamespaceAware) { if (((Element)node).getAttributeNodeNS ("http://www.w3.org/XML/1998/namespace","base")!=null) { return; } } else if (((Element)node).getAttributeNode ("xml:base") != null) { return; } // retrive the baseURI from the entity reference baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && !baseURI.equals (fDocumentImpl.getDocumentURI ())) { if (fNamespaceAware) { ((Element)node).setAttributeNS ("http://www.w3.org/XML/1998/namespace", "xml:base", baseURI); } else { ((Element)node).setAttribute ("xml:base", baseURI); } } } else if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) { baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fType = "pi-base-uri-not-preserved"; error.fRelatedData = baseURI; error.fSeverity = DOMError.SEVERITY_WARNING; fErrorHandler.getErrorHandler ().handleError (error); } } } }
Example #25
Source File: DOMParserImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a location identified by an URI reference. * If the URI contains a fragment identifier (see section 4.1 in ), the * behavior is not defined by this specification. * */ public Document parseURI (String uri) throws LSException { //If DOMParser insstance is already busy parsing another document when this // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } XMLInputSource source = new XMLInputSource (null, uri, null); try { currentThread = Thread.currentThread(); fBusy = true; parse (source); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e){ fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler ().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #26
Source File: DOMParserImpl.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Parse an XML document from a location identified by an URI reference. * If the URI contains a fragment identifier (see section 4.1 in ), the * behavior is not defined by this specification. * */ public Document parseURI (String uri) throws LSException { //If DOMParser insstance is already busy parsing another document when this // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } XMLInputSource source = new XMLInputSource (null, uri, null); try { currentThread = Thread.currentThread(); fBusy = true; parse (source); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e){ fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler ().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #27
Source File: DOMParserImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Parse an XML document from a location identified by an URI reference. * If the URI contains a fragment identifier (see section 4.1 in ), the * behavior is not defined by this specification. * */ public Document parseURI (String uri) throws LSException { //If DOMParser insstance is already busy parsing another document when this // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } XMLInputSource source = new XMLInputSource (null, uri, null); try { currentThread = Thread.currentThread(); fBusy = true; parse (source); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e){ fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler ().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #28
Source File: DOMParserImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Parse an XML document from a resource identified by an * <code>LSInput</code>. * */ public Document parse (LSInput is) throws LSException { // need to wrap the LSInput with an XMLInputSource XMLInputSource xmlInputSource = dom2xmlInputSource (is); if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } try { currentThread = Thread.currentThread(); fBusy = true; parse (xmlInputSource); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e) { fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }
Example #29
Source File: AbstractDOMParser.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Record baseURI information for the Element (by adding xml:base attribute) * or for the ProcessingInstruction (by setting a baseURI field) * Non deferred DOM. * * @param node */ protected final void handleBaseURI (Node node){ if (fDocumentImpl != null) { // REVISIT: remove dependency on our implementation when // DOM L3 becomes REC String baseURI = null; short nodeType = node.getNodeType (); if (nodeType == Node.ELEMENT_NODE) { // if an element already has xml:base attribute // do nothing if (fNamespaceAware) { if (((Element)node).getAttributeNodeNS ("http://www.w3.org/XML/1998/namespace","base")!=null) { return; } } else if (((Element)node).getAttributeNode ("xml:base") != null) { return; } // retrive the baseURI from the entity reference baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && !baseURI.equals (fDocumentImpl.getDocumentURI ())) { if (fNamespaceAware) { ((Element)node).setAttributeNS ("http://www.w3.org/XML/1998/namespace", "xml:base", baseURI); } else { ((Element)node).setAttribute ("xml:base", baseURI); } } } else if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) { baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI (); if (baseURI !=null && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fType = "pi-base-uri-not-preserved"; error.fRelatedData = baseURI; error.fSeverity = DOMError.SEVERITY_WARNING; fErrorHandler.getErrorHandler ().handleError (error); } } } }
Example #30
Source File: DOMParserImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Parse an XML document from a location identified by an URI reference. * If the URI contains a fragment identifier (see section 4.1 in ), the * behavior is not defined by this specification. * */ public Document parseURI (String uri) throws LSException { //If DOMParser insstance is already busy parsing another document when this // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec if ( fBusy ) { String msg = DOMMessageFormatter.formatMessage ( DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR",null); throw new DOMException ( DOMException.INVALID_STATE_ERR,msg); } XMLInputSource source = new XMLInputSource (null, uri, null); try { currentThread = Thread.currentThread(); fBusy = true; parse (source); fBusy = false; if (abortNow && currentThread.isInterrupted()) { //reset interrupt state abortNow = false; Thread.interrupted(); } } catch (Exception e){ fBusy = false; if (abortNow && currentThread.isInterrupted()) { Thread.interrupted(); } if (abortNow) { abortNow = false; restoreHandlers(); return null; } // Consume this exception if the user // issued an interrupt or an abort. if (e != Abort.INSTANCE) { if (!(e instanceof XMLParseException) && fErrorHandler != null) { DOMErrorImpl error = new DOMErrorImpl (); error.fException = e; error.fMessage = e.getMessage (); error.fSeverity = DOMError.SEVERITY_FATAL_ERROR; fErrorHandler.getErrorHandler ().handleError (error); } if (DEBUG) { e.printStackTrace (); } throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace(); } } Document doc = getDocument(); dropDocumentReferences(); return doc; }