Package org.w3c.tidy

Class Report

java.lang.Object
org.w3c.tidy.Report

public final class Report extends Object
Error/informational message reporter. You should only need to edit the file TidyMessages.properties to localize HTML tidy.
Version:
$Revision: 921 $ ($Author: aditsu $)
Author:
Dave Raggett dsr@w3.org , Andy Quick ac.quick@sympatico.ca (translation to Java), Fabrizio Giustina
  • Field Details

    • ACCESS_URL

      public static final String ACCESS_URL
      used to point to Web Accessibility Guidelines.
      See Also:
    • RELEASE_DATE_STRING

      public static final String RELEASE_DATE_STRING
      Release date String.
    • MISSING_SEMICOLON

      public static final short MISSING_SEMICOLON
      invalid entity: missing semicolon.
      See Also:
    • MISSING_SEMICOLON_NCR

      public static final short MISSING_SEMICOLON_NCR
      invalid entity: missing semicolon.
      See Also:
    • UNKNOWN_ENTITY

      public static final short UNKNOWN_ENTITY
      invalid entity: unknown entity.
      See Also:
    • UNESCAPED_AMPERSAND

      public static final short UNESCAPED_AMPERSAND
      invalid entity: unescaped ampersand.
      See Also:
    • APOS_UNDEFINED

      public static final short APOS_UNDEFINED
      invalid entity: apos undefined in current definition.
      See Also:
    • MISSING_ENDTAG_FOR

      public static final short MISSING_ENDTAG_FOR
      missing an end tag.
      See Also:
    • MISSING_ENDTAG_BEFORE

      public static final short MISSING_ENDTAG_BEFORE
      missing end tag before.
      See Also:
    • DISCARDING_UNEXPECTED

      public static final short DISCARDING_UNEXPECTED
      discarding unexpected element.
      See Also:
    • NESTED_EMPHASIS

      public static final short NESTED_EMPHASIS
      nested emphasis.
      See Also:
    • NON_MATCHING_ENDTAG

      public static final short NON_MATCHING_ENDTAG
      non matching end tag.
      See Also:
    • TAG_NOT_ALLOWED_IN

      public static final short TAG_NOT_ALLOWED_IN
      tag not allowed in.
      See Also:
    • MISSING_STARTTAG

      public static final short MISSING_STARTTAG
      missing start tag.
      See Also:
    • UNEXPECTED_ENDTAG

      public static final short UNEXPECTED_ENDTAG
      unexpected end tag.
      See Also:
    • USING_BR_INPLACE_OF

      public static final short USING_BR_INPLACE_OF
      unsing br in place of.
      See Also:
    • INSERTING_TAG

      public static final short INSERTING_TAG
      inserting tag.
      See Also:
    • SUSPECTED_MISSING_QUOTE

      public static final short SUSPECTED_MISSING_QUOTE
      suspected missing quote.
      See Also:
    • MISSING_TITLE_ELEMENT

      public static final short MISSING_TITLE_ELEMENT
      missing title element.
      See Also:
    • DUPLICATE_FRAMESET

      public static final short DUPLICATE_FRAMESET
      duplicate frameset.
      See Also:
    • CANT_BE_NESTED

      public static final short CANT_BE_NESTED
      elments can be nested.
      See Also:
    • OBSOLETE_ELEMENT

      public static final short OBSOLETE_ELEMENT
      obsolete element.
      See Also:
    • PROPRIETARY_ELEMENT

      public static final short PROPRIETARY_ELEMENT
      proprietary element.
      See Also:
    • UNKNOWN_ELEMENT

      public static final short UNKNOWN_ELEMENT
      unknown element.
      See Also:
    • TRIM_EMPTY_ELEMENT

      public static final short TRIM_EMPTY_ELEMENT
      trim empty element.
      See Also:
    • COERCE_TO_ENDTAG

      public static final short COERCE_TO_ENDTAG
      coerce to end tag.
      See Also:
    • ILLEGAL_NESTING

      public static final short ILLEGAL_NESTING
      illegal nesting.
      See Also:
    • NOFRAMES_CONTENT

      public static final short NOFRAMES_CONTENT
      noframes content.
      See Also:
    • CONTENT_AFTER_BODY

      public static final short CONTENT_AFTER_BODY
      content after body.
      See Also:
    • INCONSISTENT_VERSION

      public static final short INCONSISTENT_VERSION
      inconsistent version.
      See Also:
    • MALFORMED_COMMENT

      public static final short MALFORMED_COMMENT
      malformed comment.
      See Also:
    • BAD_COMMENT_CHARS

      public static final short BAD_COMMENT_CHARS
      bad coment chars.
      See Also:
    • BAD_XML_COMMENT

      public static final short BAD_XML_COMMENT
      bad xml comment.
      See Also:
    • BAD_CDATA_CONTENT

      public static final short BAD_CDATA_CONTENT
      bad cdata comment.
      See Also:
    • INCONSISTENT_NAMESPACE

      public static final short INCONSISTENT_NAMESPACE
      inconsistent namespace.
      See Also:
    • DOCTYPE_AFTER_TAGS

      public static final short DOCTYPE_AFTER_TAGS
      doctype after tags.
      See Also:
    • MALFORMED_DOCTYPE

      public static final short MALFORMED_DOCTYPE
      malformed doctype.
      See Also:
    • UNEXPECTED_END_OF_FILE

      public static final short UNEXPECTED_END_OF_FILE
      unexpected end of file.
      See Also:
    • DTYPE_NOT_UPPER_CASE

      public static final short DTYPE_NOT_UPPER_CASE
      doctype not upper case.
      See Also:
    • TOO_MANY_ELEMENTS

      public static final short TOO_MANY_ELEMENTS
      too many element.
      See Also:
    • UNESCAPED_ELEMENT

      public static final short UNESCAPED_ELEMENT
      unescaped element.
      See Also:
    • NESTED_QUOTATION

      public static final short NESTED_QUOTATION
      nested quotation.
      See Also:
    • ELEMENT_NOT_EMPTY

      public static final short ELEMENT_NOT_EMPTY
      element not empty.
      See Also:
    • ENCODING_IO_CONFLICT

      public static final short ENCODING_IO_CONFLICT
      encoding IO conflict.
      See Also:
    • MIXED_CONTENT_IN_BLOCK

      public static final short MIXED_CONTENT_IN_BLOCK
      mixed content in block.
      See Also:
    • MISSING_DOCTYPE

      public static final short MISSING_DOCTYPE
      missing doctype.
      See Also:
    • SPACE_PRECEDING_XMLDECL

      public static final short SPACE_PRECEDING_XMLDECL
      space preceding xml declaration.
      See Also:
    • TOO_MANY_ELEMENTS_IN

      public static final short TOO_MANY_ELEMENTS_IN
      too many elements in.
      See Also:
    • UNEXPECTED_ENDTAG_IN

      public static final short UNEXPECTED_ENDTAG_IN
      unexpected endag in.
      See Also:
    • REPLACING_ELEMENT

      public static final short REPLACING_ELEMENT
      replacing element.
      See Also:
    • REPLACING_UNEX_ELEMENT

      public static final short REPLACING_UNEX_ELEMENT
      replacing unexcaped element.
      See Also:
    • COERCE_TO_ENDTAG_WARN

      public static final short COERCE_TO_ENDTAG_WARN
      coerce to endtag.
      See Also:
    • UNKNOWN_ATTRIBUTE

      public static final short UNKNOWN_ATTRIBUTE
      attribute: unknown attribute.
      See Also:
    • MISSING_ATTRIBUTE

      public static final short MISSING_ATTRIBUTE
      attribute: missing attribute.
      See Also:
    • MISSING_ATTR_VALUE

      public static final short MISSING_ATTR_VALUE
      attribute: missing attribute value.
      See Also:
    • BAD_ATTRIBUTE_VALUE

      public static final short BAD_ATTRIBUTE_VALUE
      attribute: bad attribute value.
      See Also:
    • UNEXPECTED_GT

      public static final short UNEXPECTED_GT
      attribute: unexpected gt.
      See Also:
    • PROPRIETARY_ATTRIBUTE

      public static final short PROPRIETARY_ATTRIBUTE
      attribute: proprietary attribute.
      See Also:
    • PROPRIETARY_ATTR_VALUE

      public static final short PROPRIETARY_ATTR_VALUE
      attribute: proprietary attribute value.
      See Also:
    • REPEATED_ATTRIBUTE

      public static final short REPEATED_ATTRIBUTE
      attribute: repeated attribute.
      See Also:
    • MISSING_IMAGEMAP

      public static final short MISSING_IMAGEMAP
      attribute: missing image map.
      See Also:
    • XML_ATTRIBUTE_VALUE

      public static final short XML_ATTRIBUTE_VALUE
      attribute: xml attribute value.
      See Also:
    • MISSING_QUOTEMARK

      public static final short MISSING_QUOTEMARK
      attribute: missing quotemark.
      See Also:
    • UNEXPECTED_QUOTEMARK

      public static final short UNEXPECTED_QUOTEMARK
      attribute: unexpected quotemark.
      See Also:
    • ID_NAME_MISMATCH

      public static final short ID_NAME_MISMATCH
      attribute: id and name mismatch.
      See Also:
    • BACKSLASH_IN_URI

      public static final short BACKSLASH_IN_URI
      attribute: backslash in URI.
      See Also:
    • FIXED_BACKSLASH

      public static final short FIXED_BACKSLASH
      attribute: fixed backslash.
      See Also:
    • ILLEGAL_URI_REFERENCE

      public static final short ILLEGAL_URI_REFERENCE
      attribute: illegal URI reference.
      See Also:
    • ESCAPED_ILLEGAL_URI

      public static final short ESCAPED_ILLEGAL_URI
      attribute: escaped illegal URI.
      See Also:
    • NEWLINE_IN_URI

      public static final short NEWLINE_IN_URI
      attribute: newline in URI.
      See Also:
    • ANCHOR_NOT_UNIQUE

      public static final short ANCHOR_NOT_UNIQUE
      attribute: anchor not unique.
      See Also:
    • ENTITY_IN_ID

      public static final short ENTITY_IN_ID
      attribute: entity in id.
      See Also:
    • JOINING_ATTRIBUTE

      public static final short JOINING_ATTRIBUTE
      attribute: joining attribute.
      See Also:
    • UNEXPECTED_EQUALSIGN

      public static final short UNEXPECTED_EQUALSIGN
      attribute: expected equalsign.
      See Also:
    • ATTR_VALUE_NOT_LCASE

      public static final short ATTR_VALUE_NOT_LCASE
      attribute: attribute value not lower case.
      See Also:
    • XML_ID_SYNTAX

      public static final short XML_ID_SYNTAX
      attribute: id sintax.
      See Also:
    • INVALID_ATTRIBUTE

      public static final short INVALID_ATTRIBUTE
      attribute: invalid attribute.
      See Also:
    • BAD_ATTRIBUTE_VALUE_REPLACED

      public static final short BAD_ATTRIBUTE_VALUE_REPLACED
      attribute: bad attribute value replaced.
      See Also:
    • INVALID_XML_ID

      public static final short INVALID_XML_ID
      attribute: invalid xml id.
      See Also:
    • UNEXPECTED_END_OF_FILE_ATTR

      public static final short UNEXPECTED_END_OF_FILE_ATTR
      attribute: unexpected end of file.
      See Also:
    • VENDOR_SPECIFIC_CHARS

      public static final short VENDOR_SPECIFIC_CHARS
      character encoding: vendor specific chars.
      See Also:
    • INVALID_SGML_CHARS

      public static final short INVALID_SGML_CHARS
      character encoding: invalid sgml chars.
      See Also:
    • INVALID_UTF8

      public static final short INVALID_UTF8
      character encoding: invalid utf8.
      See Also:
    • INVALID_UTF16

      public static final short INVALID_UTF16
      character encoding: invalid utf16.
      See Also:
    • ENCODING_MISMATCH

      public static final short ENCODING_MISMATCH
      character encoding: encoding mismatch.
      See Also:
    • INVALID_URI

      public static final short INVALID_URI
      character encoding: nvalid URI.
      See Also:
    • INVALID_NCR

      public static final short INVALID_NCR
      character encoding: invalid NCR.
      See Also:
    • DOCTYPE_GIVEN_SUMMARY

      public static final short DOCTYPE_GIVEN_SUMMARY
      Constant used for reporting of given doctype.
      See Also:
    • REPORT_VERSION_SUMMARY

      public static final short REPORT_VERSION_SUMMARY
      Constant used for reporting of version summary.
      See Also:
    • BADACCESS_SUMMARY

      public static final short BADACCESS_SUMMARY
      Constant used for reporting of bad access summary.
      See Also:
    • BADFORM_SUMMARY

      public static final short BADFORM_SUMMARY
      Constant used for reporting of bad form summary.
      See Also:
    • MISSING_IMAGE_ALT

      public static final short MISSING_IMAGE_ALT
      accessibility flaw: missing image map.
      See Also:
    • MISSING_SUMMARY

      public static final short MISSING_SUMMARY
      accessibility flaw: missing summary.
      See Also:
    • MISSING_IMAGE_MAP

      public static final short MISSING_IMAGE_MAP
      accessibility flaw: missing image map.
      See Also:
    • USING_FRAMES

      public static final short USING_FRAMES
      accessibility flaw: using frames.
      See Also:
    • USING_NOFRAMES

      public static final short USING_NOFRAMES
      accessibility flaw: using noframes.
      See Also:
    • USING_SPACER

      public static final short USING_SPACER
      presentation flaw: using spacer.
      See Also:
    • USING_LAYER

      public static final short USING_LAYER
      presentation flaw: using layer.
      See Also:
    • USING_NOBR

      public static final short USING_NOBR
      presentation flaw: using nobr.
      See Also:
    • USING_FONT

      public static final short USING_FONT
      presentation flaw: using font.
      See Also:
    • USING_BODY

      public static final short USING_BODY
      presentation flaw: using body.
      See Also:
    • WINDOWS_CHARS

      public static final short WINDOWS_CHARS
      character encoding error: windows chars.
      See Also:
    • NON_ASCII

      public static final short NON_ASCII
      character encoding error: non ascii.
      See Also:
    • FOUND_UTF16

      public static final short FOUND_UTF16
      character encoding error: found utf16.
      See Also:
    • REPLACED_CHAR

      public static final short REPLACED_CHAR
      char has been replaced.
      See Also:
    • DISCARDED_CHAR

      public static final short DISCARDED_CHAR
      char has been discarder.
      See Also:
  • Constructor Details

    • Report

      protected Report()
      Instantiated only in Tidy() constructor.
  • Method Details

    • getMessage

      protected String getMessage(int errorCode, Lexer lexer, String message, Object[] params, TidyMessage.Level level) throws MissingResourceException
      Generates a complete message for the warning/error. The message is composed by:
      • position in file
      • prefix for the error level (warning: | error:)
      • message read from ResourceBundle
      • optional parameters added to message using MessageFormat
      Parameters:
      errorCode - tidy error code
      lexer - Lexer
      message - key for the ResourceBundle
      params - optional parameters added with MessageFormat
      level - message level. One of TidyMessage.LEVEL_ERROR, TidyMessage.LEVEL_WARNING,TidyMessage.LEVEL_INFO
      Returns:
      formatted message
      Throws:
      MissingResourceException - if message key is not available in jtidy resource bundle.
      See Also:
    • showVersion

      public void showVersion(PrintWriter p)
      print version information.
      Parameters:
      p - printWriter
    • unknownOption

      public void unknownOption(String option)
      Prints an "unknown option" error message. Lexer is not defined when this is called.
      Parameters:
      option - unknown option name
    • badArgument

      public void badArgument(String key, String value)
      Prints a "bad argument" error message. Lexer is not defined when this is called.
      Parameters:
      key - argument name
      value - bad argument value
    • encodingError

      public void encodingError(Lexer lexer, int code, int c)
      Prints encoding error messages.
      Parameters:
      lexer - Lexer
      code - error code
      c - invalid char
    • entityError

      public void entityError(Lexer lexer, short code, String entity, int c)
      Prints entity error messages.
      Parameters:
      lexer - Lexer
      code - error code
      entity - invalid entity String
      c - invalid char
    • attrError

      public void attrError(Lexer lexer, Node node, AttVal attribute, short code)
      Prints error messages for attributes.
      Parameters:
      lexer - Lexer
      node - current tag
      attribute - attribute
      code - error code
    • warning

      public void warning(Lexer lexer, Node element, Node node, short code)
      Prints warnings.
      Parameters:
      lexer - Lexer
      element - parent/missing tag
      node - current tag
      code - error code
    • error

      public void error(Lexer lexer, Node element, Node node, short code)
      Prints errors.
      Parameters:
      lexer - Lexer
      element - parent/missing tag
      node - current tag
      code - error code
    • errorSummary

      public void errorSummary(Lexer lexer)
      Prints error summary.
      Parameters:
      lexer - Lexer
    • unknownOption

      public void unknownOption(PrintWriter errout, char c)
      Prints the "unknown option" message.
      Parameters:
      errout - PrintWriter
      c - invalid option char
    • unknownFile

      public void unknownFile(PrintWriter errout, String file)
      Prints the "unknown file" message.
      Parameters:
      errout - PrintWriter
      file - invalid file name
    • needsAuthorIntervention

      public void needsAuthorIntervention(PrintWriter errout)
      Prints the "needs author intervention" message.
      Parameters:
      errout - PrintWriter
    • missingBody

      public void missingBody(PrintWriter errout)
      Prints the "missing body" message.
      Parameters:
      errout - PrintWriter
    • reportNumberOfSlides

      public void reportNumberOfSlides(PrintWriter errout, int count)
      Prints the number of generated slides.
      Parameters:
      errout - PrintWriter
      count - slides count
    • generalInfo

      public void generalInfo(PrintWriter errout)
      Prints tidy general info.
      Parameters:
      errout - PrintWriter
    • setFilename

      public void setFilename(String filename)
      Sets the current file name.
      Parameters:
      filename - current file.
    • reportVersion

      public void reportVersion(PrintWriter errout, Lexer lexer, String filename, Node doctype)
      Prints information for html version in input file.
      Parameters:
      errout - PrintWriter
      lexer - Lexer
      filename - file name
      doctype - doctype Node
    • reportNumWarnings

      public void reportNumWarnings(PrintWriter errout, Lexer lexer)
      Prints the number of error/warnings found.
      Parameters:
      errout - PrintWriter
      lexer - Lexer
    • helpText

      public void helpText(PrintWriter out)
      Prints tidy help.
      Parameters:
      out - PrintWriter
    • badTree

      public void badTree(PrintWriter errout)
      Prints the "bad tree" message.
      Parameters:
      errout - PrintWriter
    • addMessageListener

      public void addMessageListener(TidyMessageListener listener)
      Adds a message listener.
      Parameters:
      listener - TidyMessageListener