org.w3c.mwi.mobileok.basic
Class XHTMLValidationErrorHandler
java.lang.Object
org.w3c.mwi.mobileok.basic.XHTMLValidationErrorHandler
- All Implemented Interfaces:
- org.xml.sax.ErrorHandler
final class XHTMLValidationErrorHandler
- extends java.lang.Object
- implements org.xml.sax.ErrorHandler
Handler for XML validation errors.
An instance of the XHTMLValidationErrorHandler
class may be set
as the default error handler for all XML validation errors before parsing
an XML stream with an XMLReader
through a call to
XMLReader.setErrorHandler(ErrorHandler)
.
XML validation errors will be stored in a list of
ValidationLineAndColumnMessage
, accessible through a call to
getXhtmlErrorMessageList()
.
Although the class uses the term "XHTML", there is nothing specific to
XHTML here. It could be used as a handler for the validation of any kind
of XML stream.
Two of the warning messages that may be returned by the XML parser are
automatically converted on-the-fly because they are rather confusing. These
messages are defined in com.sun.org.apache.xerces.internal.impl.msg.XMLMessages
.
They are:
- MSG_ATTRIBUTE_NOT_DECLARED from 'Attribute "[attribute]" must
be declared for element type "[element]".' to 'Attribute "[attribute]" is
not allowed for element type "[element]".'
- MSG_ELEMENT_NOT_DECLARED from 'Element type "[element]" must
be declared.' to 'Element type "[element]" is not allowed.'
- Version:
- $Revision: 1.1 $
- Author:
- The W3C mobileOK Checker Task Force
- See Also:
XhtmlContent
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
xhtmlErrorMessageList
private final java.util.List<ValidationLineAndColumnMessage> xhtmlErrorMessageList
xhtmlValidationStatus
private XHTMLValidationStatus xhtmlValidationStatus
msgAttributeNotDeclaredPattern
private static final java.util.regex.Pattern msgAttributeNotDeclaredPattern
msgElementNotDeclaredPattern
private static final java.util.regex.Pattern msgElementNotDeclaredPattern
XHTMLValidationErrorHandler
XHTMLValidationErrorHandler()
warning
public void warning(org.xml.sax.SAXParseException spe)
- Specified by:
warning
in interface org.xml.sax.ErrorHandler
error
public void error(org.xml.sax.SAXParseException spe)
- Specified by:
error
in interface org.xml.sax.ErrorHandler
fatalError
public void fatalError(org.xml.sax.SAXParseException spe)
- Specified by:
fatalError
in interface org.xml.sax.ErrorHandler
doAddException
private void doAddException(org.xml.sax.SAXParseException spe)
validationStatus
public XHTMLValidationStatus validationStatus()
getXhtmlErrorMessageList
public java.util.List<ValidationLineAndColumnMessage> getXhtmlErrorMessageList()
unknownDtd
public void unknownDtd()