nu.validator.messages
Class MessageEmitterAdapter

java.lang.Object
  extended by nu.validator.messages.MessageEmitterAdapter
All Implemented Interfaces:
ErrorHandler

public final class MessageEmitterAdapter
extends Object
implements ErrorHandler


Nested Class Summary
private  class MessageEmitterAdapter.ExactErrorHandler
           
 
Field Summary
private  MessageEmitter emitter
           
private  int errors
           
private  MessageEmitterAdapter.ExactErrorHandler exactErrorHandler
           
private  int fatalErrors
           
private static char[] INDETERMINATE_MESSAGE
           
private  int nonDocumentErrors
           
private  boolean showSource
           
private  SourceCode sourceCode
           
private  int warnings
           
 
Constructor Summary
MessageEmitterAdapter(SourceCode sourceCode, boolean showSource, MessageEmitter messageEmitter)
           
 
Method Summary
private  void emitStringWithQurlyQuotes(String message, MessageTextHandler messageTextHandler)
           
 void end(String successMessage, String failureMessage)
           
 void error(SAXParseException e)
           
private  void error(SAXParseException e, boolean exact)
           
 void fatalError(SAXParseException e)
           
private  void fatalError(SAXParseException e, boolean exact)
           
 int getErrors()
           
 ErrorHandler getExactErrorHandler()
          Returns the exactErrorHandler.
 int getFatalErrors()
           
 int getWarnings()
           
 void info(String str)
           
 void internalError(Throwable e, String message)
           
 void ioError(IOException e)
           
private  boolean isErrors()
           
private  boolean isIndeterminate()
           
private  void message(MessageType type, String message, String systemId, int oneBasedLine, int oneBasedColumn, boolean exact)
           
private  void messageFromSAXParseException(MessageType type, SAXParseException spe, boolean exact)
           
private  void messageText(String message)
           
private  void messageWithExact(MessageType type, String message, int oneBasedLine, int oneBasedColumn)
           
private  void messageWithLine(MessageType type, String message, int oneBasedLine)
           
private  void messageWithoutExtract(MessageType type, String message, String systemId, int oneBasedLine, int oneBasedColumn)
           
private  void messageWithRange(MessageType type, String message, int oneBasedLine, int oneBasedColumn)
           
 void schemaError(Exception e)
           
protected static String scrub(String s)
           
 void start(String documentUri)
           
 void warning(SAXParseException e)
           
private  void warning(SAXParseException e, boolean exact)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDETERMINATE_MESSAGE

private static final char[] INDETERMINATE_MESSAGE

warnings

private int warnings

errors

private int errors

fatalErrors

private int fatalErrors

nonDocumentErrors

private int nonDocumentErrors

sourceCode

private final SourceCode sourceCode

emitter

private final MessageEmitter emitter

exactErrorHandler

private final MessageEmitterAdapter.ExactErrorHandler exactErrorHandler

showSource

private final boolean showSource
Constructor Detail

MessageEmitterAdapter

public MessageEmitterAdapter(SourceCode sourceCode,
                             boolean showSource,
                             MessageEmitter messageEmitter)
Method Detail

scrub

protected static String scrub(String s)
                       throws SAXException
Throws:
SAXException

getErrors

public int getErrors()
Returns:
Returns the errors.

getFatalErrors

public int getFatalErrors()
Returns:
Returns the fatalErrors.

getWarnings

public int getWarnings()
Returns:
Returns the warnings.

isErrors

private boolean isErrors()

warning

public void warning(SAXParseException e)
             throws SAXException
Specified by:
warning in interface ErrorHandler
Throws:
SAXException
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException)

warning

private void warning(SAXParseException e,
                     boolean exact)
              throws SAXException
Parameters:
e -
Throws:
SAXException

error

public void error(SAXParseException e)
           throws SAXException
Specified by:
error in interface ErrorHandler
Throws:
SAXException
See Also:
ErrorHandler.error(org.xml.sax.SAXParseException)

error

private void error(SAXParseException e,
                   boolean exact)
            throws SAXException
Parameters:
e -
Throws:
SAXException

fatalError

public void fatalError(SAXParseException e)
                throws SAXException
Specified by:
fatalError in interface ErrorHandler
Throws:
SAXException
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException)

fatalError

private void fatalError(SAXParseException e,
                        boolean exact)
                 throws SAXException
Parameters:
e -
Throws:
SAXException

info

public void info(String str)
          throws SAXException
Throws:
SAXException
See Also:
nu.validator.servlet.InfoErrorHandler#info(java.lang.String)

ioError

public void ioError(IOException e)
             throws SAXException
Throws:
SAXException
See Also:
nu.validator.servlet.InfoErrorHandler#ioError(java.io.IOException)

internalError

public void internalError(Throwable e,
                          String message)
                   throws SAXException
Throws:
SAXException
See Also:
nu.validator.servlet.InfoErrorHandler#internalError(java.lang.Throwable, java.lang.String)

schemaError

public void schemaError(Exception e)
                 throws SAXException
Throws:
SAXException
See Also:
nu.validator.servlet.InfoErrorHandler#schemaError(java.lang.Exception)

start

public void start(String documentUri)
           throws SAXException
Throws:
SAXException
See Also:
nu.validator.servlet.InfoErrorHandler#start()

end

public void end(String successMessage,
                String failureMessage)
         throws SAXException
Throws:
SAXException
See Also:
nu.validator.servlet.InfoErrorHandler#end()

isIndeterminate

private boolean isIndeterminate()

messageFromSAXParseException

private void messageFromSAXParseException(MessageType type,
                                          SAXParseException spe,
                                          boolean exact)
                                   throws SAXException
Throws:
SAXException

message

private void message(MessageType type,
                     String message,
                     String systemId,
                     int oneBasedLine,
                     int oneBasedColumn,
                     boolean exact)
              throws SAXException
Throws:
SAXException

messageWithRange

private void messageWithRange(MessageType type,
                              String message,
                              int oneBasedLine,
                              int oneBasedColumn)
                       throws SAXException
Throws:
SAXException

messageWithExact

private void messageWithExact(MessageType type,
                              String message,
                              int oneBasedLine,
                              int oneBasedColumn)
                       throws SAXException
Throws:
SAXException

messageWithLine

private void messageWithLine(MessageType type,
                             String message,
                             int oneBasedLine)
                      throws SAXException
Throws:
SAXException

messageWithoutExtract

private void messageWithoutExtract(MessageType type,
                                   String message,
                                   String systemId,
                                   int oneBasedLine,
                                   int oneBasedColumn)
                            throws SAXException
Throws:
SAXException

messageText

private void messageText(String message)
                  throws SAXException
Parameters:
message -
Throws:
SAXException

emitStringWithQurlyQuotes

private void emitStringWithQurlyQuotes(String message,
                                       MessageTextHandler messageTextHandler)
                                throws SAXException
Throws:
SAXException

getExactErrorHandler

public ErrorHandler getExactErrorHandler()
Returns the exactErrorHandler.

Returns:
the exactErrorHandler