All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----org.xml.sax.helpers.DefaultHandler | +----org.jdom.input.SAXHandler
SAXHandler
supports SAXBuilder
This will create a new SAXHandler
that listens to SAX
events and creates a JDOM Document.
This will set the Document
to use.
Deprecated.
This will create a new SAXHandler
that listens to SAX
events and creates a JDOM Document.
This will report character data (within an element).
This reports that a comments is parsed.
Report a CDATA section - ignored in SAXBuilder.
This signifies that the reading of the DTD is complete.
Indicates the end of an element
(</[element name]>
) is reached.
This will add the prefix mapping to the JDOM
Document
object.
Returns the document.
Capture ignorable whitespace as text.
This will indicate that a processing instruction (other than the XML declaration) has been encountered.
This sets whether or not to expand entities during the build.
Specifies whether or not the parser should elminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document.
Report a CDATA section - ignored in SAXBuilder.
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.
This reports the occurrence of an actual element.
This will add the prefix mapping to the JDOM
Document
object.
public SAXHandler(Document document) throws IOException
This will set the Document
to use.
Document
being parsed.
public SAXHandler() throws IOException
This will create a new SAXHandler
that listens to SAX
events and creates a JDOM Document. The objects will be constructed
using the default factory.
public SAXHandler(JDOMFactory factory) throws IOException
This will create a new SAXHandler
that listens to SAX
events and creates a JDOM Document. The objects will be constructed
using the provided factory.
JDOMFactory
to be used for constructing
objects
public Document getDocument()
Returns the document. Should be called after parsing is complete.
Document
- Document that was built
public void setExpandEntities(boolean expand)
This sets whether or not to expand entities during the build.
A true means to expand entities as normal content. A false means to
leave entities unexpanded as EntityRef
objects. The
default is true.
boolean
indicating whether entity expansion
should occur.
public void setIgnoringElementContentWhitespace(boolean ignoringWhite)
Specifies whether or not the parser should elminate whitespace in
element content (sometimes known as "ignorable whitespace") when
building the document. Only whitespace which is contained within
element content that has an element only content model will be
eliminated (see XML Rec 3.2.1). For this setting to take effect
requires that validation be turned on. The default value of this
setting is false
.
public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException
public void attributeDecl(String eName, String aName, String type, String valueDefault, String value)
public void elementDecl(String name, String model)
public void internalEntityDecl(String name, String value)
public void processingInstruction(String target, String data) throws SAXException
This will indicate that a processing instruction (other than the XML declaration) has been encountered.
String
target of PI
String
Throws: SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
This will add the prefix mapping to the JDOM
Document
object.
String
namespace prefix.
String
namespace URI.
public void endPrefixMapping(String prefix) throws SAXException
This will add the prefix mapping to the JDOM
Document
object.
String
namespace prefix.
String
namespace URI.
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
.
String
namespace URI this element
is associated with, or an empty
String
String
name of element (with no
namespace prefix, if one is present)
String
XML 1.0 version of element name:
[namespace prefix]:[localName]
Attributes
list for this element
public void characters(char ch[], int start, int length) throws SAXException
This will report character data (within an element).
char[]
character array with character data
int
index in array where data starts.
int
length of data.
public void ignorableWhitespace(char ch[], int start, int length) throws SAXException
Capture ignorable whitespace as text. If setIgnoringElementContentWhitespace(true) has been called then this method does nothing.
[]
- char array of ignorable whitespace
int
- starting position within array
int
- length of whitespace after start
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
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.
String
URI of namespace this
element is associated with
String
name of element without prefix
String
name of element in XML 1.0 form
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.
String
name of element listed in DTD
String
public ID of DTD
String
syste ID of DTD
public void endDTD() throws SAXException
This signifies that the reading of the DTD is complete.
public void startEntity(String name) throws SAXException
public void endEntity(String name) throws SAXException
public void startCDATA() throws SAXException
Report a CDATA section - ignored in SAXBuilder.
public void endCDATA() throws SAXException
Report a CDATA section - ignored in SAXBuilder.
public void comment(char ch[], int start, int length) 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.
ch[]
array of comment characters.
int
index to start reading from.
int
length of data.
All Packages Class Hierarchy This Package Previous Next Index