ContentHandler (interface)

Defines methods that are called by the underlying XML Reader based on events generated while reading the XML Document.

Events

  • Invoked when the start of a Document has been found.

    startDocument()

    Can be used to initialise...

  • Invoked when the end of a Document has been found.

    endDocument()

    Can be used to wrap-up any unfinished business.

  • (If implemented by the XMLReader implementation) Invoked before any of the other methods are called with the information about the text location.

    setDocumentLocator( Locator locator)

    Can be used to keep track of line-numbers in the XML.

  • Invoked when a prefix + namespace-uri comes into scope.

    startPrefixMapping( String prefix, String uri)

    Note

    Always invoked before a startElement event.
  • Invoked when a prefix + namespace-uri is no longer in scope.

    endPrefixMapping( String prefix, String uri)

    Note

    Always invoked after an endElement event.
  • Invoked when an element start-tag has been encountered.

    startElement( String uri, String localName, String qName, Attributes atts)
  • Invoked when an element end-tag has been encountered.

    endElement( String uri, String localName, String qName)
  • Invoked when whitespace has been found that can be ignored according to external rules.

    ignorableWhitespace( char[] ch, int start, int length)

    Note

    The white-space information can be split over multiple calls.
  • Invoked when character data has been found.

    characters( char[] ch, int start, int length)

    Note

    The character information can be split over multiple calls.
  • Invoked when a processing-instruction node has been found.

    processingInstruction( String target, String data)
  • Invoked when an entity is skipped (this is the case when the entity has been declared in an external DTD).

    skippedEntity( String name)