org.w3c.mwi.mobileok.basic
Class XHTMLValidationErrorHandler

java.lang.Object
  extended by 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:

Version:
$Revision: 1.1 $
Author:
The W3C mobileOK Checker Task Force
See Also:
XhtmlContent

Field Summary
private static java.util.regex.Pattern msgAttributeNotDeclaredPattern
           
private static java.util.regex.Pattern msgElementNotDeclaredPattern
           
private  java.util.List<ValidationLineAndColumnMessage> xhtmlErrorMessageList
           
private  XHTMLValidationStatus xhtmlValidationStatus
           
 
Constructor Summary
XHTMLValidationErrorHandler()
           
 
Method Summary
private  void doAddException(org.xml.sax.SAXParseException spe)
           
 void error(org.xml.sax.SAXParseException spe)
           
 void fatalError(org.xml.sax.SAXParseException spe)
           
 java.util.List<ValidationLineAndColumnMessage> getXhtmlErrorMessageList()
           
 void unknownDtd()
           
 XHTMLValidationStatus validationStatus()
           
 void warning(org.xml.sax.SAXParseException spe)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

XHTMLValidationErrorHandler

XHTMLValidationErrorHandler()
Method Detail

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()