org.jdom.input
Class SAXHandler

|
+--org.jdom.input.SAXHandler

class SAXHandler
extends DefaultHandler
implements LexicalHandler


Constructor Summary
SAXHandler(Document document)
           This will set the Document to use.

Method Summary
 voidcharacters(char[] ch, int start, int end)
           This will report character data (within an element).
 voidcomment(char[] ch, int start, int end)
           This reports that a comments is parsed.
 voidendCDATA()
           Report a CDATA section - ignored in SAXBuilder.
 voidendDTD()
           This signifies that the reading of the DTD is complete.
 voidendElement(String namespaceURI, String localName, String rawName)
           Indicates the end of an element (</[element name]>) is reached.
 voidendEntity(String name)
           
 voidendPrefixMapping(String prefix)
           This will add the prefix mapping to the JDOM Document object.
 voidprocessingInstruction(String target, String data)
           This will indicate that a processing instruction (other than the XML declaration) has been encountered.
 voidstartCDATA()
           Report a CDATA section - ignored in SAXBuilder.
 voidstartDTD(String name, String publicId, String systemId)
           This will signify that a DTD is being parsed, and can be used to ensure that comments and other lexical structures in the DTD are not added to the JDOM Document object.
 voidstartElement(String namespaceURI, String localName, String qName, Attributes atts)
           This reports the occurrence of an actual element.
 voidstartEntity(String name)
           
 voidstartPrefixMapping(String prefix, String uri)
           This will add the prefix mapping to the JDOM Document object.

Constructor Detail

SAXHandler

public SAXHandler(Document document)
throws java.io.IOException

This will set the Document to use.

Parameters:
document - Document being parsed.
Throws:
IOException - when errors occur.
Method Detail

characters

public void characters(char[] ch, int start, int end)
throws SAXException

This will report character data (within an element).

Parameters:
ch - char[] character array with character data
start - int index in array where data starts.
end - int index in array where data ends.
Throws:
SAXException - when things go wrong

comment

public void comment(char[] ch, int start, int end)
throws SAXException

This reports that a comments is parsed. If not in the DTD, this comment is added to the current JDOM Element, or the Document itself if at that level.

Parameters:
ch - ch[] array of comment characters.
start - int index to start reading from.
end - int index to end reading at.

endCDATA

public void endCDATA()
throws SAXException

Report a CDATA section - ignored in SAXBuilder.


endDTD

public void endDTD()
throws SAXException

This signifies that the reading of the DTD is complete.


endElement

public void endElement(String namespaceURI, String localName, String rawName)

Indicates the end of an element (</[element name]>) is reached. Note that the parser does not distinguish between empty elements and non-empty elements, so this will occur uniformly.

Parameters:
namespaceURI - String URI of namespace this element is associated with
localName - String name of element without prefix
rawName - String name of element in XML 1.0 form
Throws:
SAXException - when things go wrong

endEntity

public void endEntity(String name)
throws SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
throws SAXException

This will add the prefix mapping to the JDOM Document object.

Parameters:
prefix - String namespace prefix.
uri - String namespace URI.

processingInstruction

public void processingInstruction(String target, String data)
throws SAXException

This will indicate that a processing instruction (other than the XML declaration) has been encountered.

Parameters:
target - String target of PI
data - StringThrows:
SAXException - when things go wrong

startCDATA

public void startCDATA()
throws SAXException

Report a CDATA section - ignored in SAXBuilder.


startDTD

public void startDTD(String name, String publicId, String systemId)
throws SAXException

This will signify that a DTD is being parsed, and can be used to ensure that comments and other lexical structures in the DTD are not added to the JDOM Document object.

Parameters:
name - String name of element listed in DTD
publicId - String public ID of DTD
systemId - String syste ID of DTD

startElement

public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
throws SAXException

This reports the occurrence of an actual element. It will include the element's attributes, with the exception of XML vocabulary specific attributes, such as xmlns:[namespace prefix] and xsi:schemaLocation.

Parameters:
namespaceURI - String namespace URI this element is associated with, or an empty String
localName - String name of element (with no namespace prefix, if one is present)
qName - String XML 1.0 version of element name: [namespace prefix]:[localName]
atts - Attributes list for this element
Throws:
SAXException - when things go wrong

startEntity

public void startEntity(String name)
throws SAXException

startPrefixMapping

public void startPrefixMapping(String prefix, String uri)
throws SAXException

This will add the prefix mapping to the JDOM Document object.

Parameters:
prefix - String namespace prefix.
uri - String namespace URI.

Association Links

to Class org.jdom.Document

Document object being built

to Class java.util.Stack

Element stack

to Class java.util.LinkedList

Temporary holder for namespaces that have been declared with startPrefixMapping, but are not yet available on the element

to Class java.util.LinkedList

The namespaces in scope and actually attached to an element