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.
Appends an external ID to the internal subset buffer.
This handles an attribute declaration in the internal subset
This will report character data (within an element).
This reports that a comments is parsed.
Handle an element declaration in a DTD
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.
This will flush any characters from SAX character calls we've been buffering.
Returns the being-parsed element.
Returns the document.
Provides access to the {
Returns whether or not entities will be expanded during the build.
Returns the factory used for constructing objects.
Returns whether or not the parser will elminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document.
Capture ignorable whitespace as text.
Handle an internal entity declaration in a DTD.
Handle the declaration of a Notation in a DTD
This will indicate that a processing instruction has been encountered.
Receives an object for locating the origin of SAX document events.
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.
This indicates that an unresolvable entity reference has been encountered, normally because the external DTD subset has not been read.
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.
Handler for unparsed entity declarations in the DTD
protected Stack stack
protected boolean atRoot
protected boolean inDTD
protected boolean inInternalSubset
protected boolean previousCDATA
protected boolean inCDATA
protected boolean suppress
protected LinkedList declaredNamespaces
protected LinkedList availableNamespaces
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 JDOMFactory getFactory()
Returns the factory used for constructing objects.
JDOMFactory
- the factory used for
constructing objects.
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 boolean getExpandEntities()
Returns whether or not entities will be expanded during the build.
boolean
- whether entity expansion
will occur during build.
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 boolean getIgnoringElementContentWhitespace()
Returns whether or not the parser will elminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document.
boolean
- whether ignorable whitespace will
be ignored during build.
public void externalEntityDecl(String name, String publicID, String systemID) throws SAXException
public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException
This handles an attribute declaration in the internal subset
String
element name of attribute
String
attribute name
String
attribute type
String
default value of attribute
String
value of attribute
public void elementDecl(String name, String model) throws SAXException
Handle an element declaration in a DTD
String
name of element
String
model of the element in DTD syntax
public void internalEntityDecl(String name, String value) throws SAXException
Handle an internal entity declaration in a DTD.
String
name of entity
String
value of the entity
public void processingInstruction(String target, String data) throws SAXException
This will indicate that a processing instruction has been encountered. (The XML declaration is not a processing instruction and will not be reported.)
String
target of PI
String
containing all data sent to the PI.
This typically looks like one or more attribute value
pairs.
public void skippedEntity(String name) throws SAXException
This indicates that an unresolvable entity reference has been encountered, normally because the external DTD subset has not been read.
String
name of entity
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.
protected void flushCharacters() throws SAXException
This will flush any characters from SAX character calls we've been buffering.
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
system 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.
public void notationDecl(String name, String publicID, String systemID) throws SAXException
Handle the declaration of a Notation in a DTD
public void unparsedEntityDecl(String name, String publicID, String systemID, String notationName) throws SAXException
Handler for unparsed entity declarations in the DTD
String
of the unparsed entity decl
String
of the unparsed entity decl
String
of the unparsed entity decl
String
of the unparsed entity decl
protected void appendExternalId(String publicID, String systemID)
Appends an external ID to the internal subset buffer. Either publicID or systemID may be null, but not both.
protected Element getCurrentElement() throws SAXException
Returns the being-parsed element.
Element
- element at the top of the stack.
public void setDocumentLocator(Locator locator)
Receives an object for locating the origin of SAX document events. This method is invoked by the SAX parser.
{@link JDOMFactory} implementations can use the {@link #getDocumentLocator} method to get access to the {@link Locator} during parse.
Locator
an object that can return
the location of any SAX document event.
public Locator getDocumentLocator()
Provides access to the {@link Locator} object provided by the SAX parser.
Locator
an object that can return
the location of any SAX document event.
All Packages Class Hierarchy This Package Previous Next Index