Java Code Examples for org.w3c.dom.DOMError#SEVERITY_WARNING
The following examples show how to use
org.w3c.dom.DOMError#SEVERITY_WARNING .
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: DOMErrorHandlerWrapper.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Reports a warning. Warnings are non-fatal and can be safely ignored * by most applications. * * @param domain The domain of the warning. The domain can be any * string but is suggested to be a valid URI. The * domain can be used to conveniently specify a web * site location of the relevent specification or * document pertaining to this warning. * @param key The warning key. This key can be any string and * is implementation dependent. * @param exception Exception. * * @throws XNIException Thrown to signal that the parser should stop * parsing the document. */ public void warning(String domain, String key, XMLParseException exception) throws XNIException { fDOMError.fSeverity = DOMError.SEVERITY_WARNING; fDOMError.fException = exception; // REVISIT: May need to lookup from DOMErrorTypeMap in the future. fDOMError.fType = key; fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage(); DOMLocatorImpl locator = fDOMError.fLocator; if (locator != null) { locator.fColumnNumber = exception.getColumnNumber(); locator.fLineNumber = exception.getLineNumber(); locator.fUtf16Offset = exception.getCharacterOffset(); locator.fUri = exception.getExpandedSystemId(); locator.fRelatedNode = fCurrentNode; } if (fDomErrorHandler != null) { fDomErrorHandler.handleError(fDOMError); } }
Example 2
Source File: DOMErrorHandlerWrapper.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Reports a warning. Warnings are non-fatal and can be safely ignored * by most applications. * * @param domain The domain of the warning. The domain can be any * string but is suggested to be a valid URI. The * domain can be used to conveniently specify a web * site location of the relevent specification or * document pertaining to this warning. * @param key The warning key. This key can be any string and * is implementation dependent. * @param exception Exception. * * @throws XNIException Thrown to signal that the parser should stop * parsing the document. */ public void warning(String domain, String key, XMLParseException exception) throws XNIException { fDOMError.fSeverity = DOMError.SEVERITY_WARNING; fDOMError.fException = exception; // REVISIT: May need to lookup from DOMErrorTypeMap in the future. fDOMError.fType = key; fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage(); DOMLocatorImpl locator = fDOMError.fLocator; if (locator != null) { locator.fColumnNumber = exception.getColumnNumber(); locator.fLineNumber = exception.getLineNumber(); locator.fUtf16Offset = exception.getCharacterOffset(); locator.fUri = exception.getExpandedSystemId(); locator.fRelatedNode = fCurrentNode; } if (fDomErrorHandler != null) { fDomErrorHandler.handleError(fDOMError); } }
Example 3
Source File: DOMErrorHandlerWrapper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Reports a warning. Warnings are non-fatal and can be safely ignored * by most applications. * * @param domain The domain of the warning. The domain can be any * string but is suggested to be a valid URI. The * domain can be used to conveniently specify a web * site location of the relevent specification or * document pertaining to this warning. * @param key The warning key. This key can be any string and * is implementation dependent. * @param exception Exception. * * @throws XNIException Thrown to signal that the parser should stop * parsing the document. */ public void warning(String domain, String key, XMLParseException exception) throws XNIException { fDOMError.fSeverity = DOMError.SEVERITY_WARNING; fDOMError.fException = exception; // REVISIT: May need to lookup from DOMErrorTypeMap in the future. fDOMError.fType = key; fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage(); DOMLocatorImpl locator = fDOMError.fLocator; if (locator != null) { locator.fColumnNumber = exception.getColumnNumber(); locator.fLineNumber = exception.getLineNumber(); locator.fUtf16Offset = exception.getCharacterOffset(); locator.fUri = exception.getExpandedSystemId(); locator.fRelatedNode = fCurrentNode; } if (fDomErrorHandler != null) { fDomErrorHandler.handleError(fDOMError); } }
Example 4
Source File: DOMErrorImpl.java From Bytecoder with Apache License 2.0 | 5 votes |
public void reset(){ fSeverity = DOMError.SEVERITY_WARNING; fException = null; fMessage = null; fType = null; fRelatedData = null; fLocation = null; }
Example 5
Source File: DOMErrorImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void reset(){ fSeverity = DOMError.SEVERITY_WARNING; fException = null; fMessage = null; fType = null; fRelatedData = null; fLocation = null; }
Example 6
Source File: DOMErrorHandlerWrapper.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 7
Source File: DOMErrorImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
public void reset(){ fSeverity = DOMError.SEVERITY_WARNING; fException = null; }
Example 8
Source File: DOMErrorImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
public void reset(){ fSeverity = DOMError.SEVERITY_WARNING; fException = null; }
Example 9
Source File: AbstractDOMParser.java From openjdk-jdk8u 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 10
Source File: DOMErrorHandlerWrapper.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 11
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 12
Source File: AbstractDOMParser.java From openjdk-jdk8u-backup 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: DOMErrorHandlerWrapper.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 14
Source File: DOMErrorHandlerWrapper.java From Bytecoder with Apache License 2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 15
Source File: DOMErrorImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void reset(){ fSeverity = DOMError.SEVERITY_WARNING; fException = null; }
Example 16
Source File: AbstractDOMParser.java From jdk8u60 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: 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 18
Source File: DOMErrorImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void reset(){ fSeverity = DOMError.SEVERITY_WARNING; fException = null; }
Example 19
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 20
Source File: DOMErrorHandlerWrapper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }