org.jdom.input
public class SAXHandler extends DefaultHandler implements LexicalHandler, DeclHandler, DTDHandler
Version: $Revision: 1.68 $, $Date: 2004/08/31 06:14:05 $
Constructor Summary | |
---|---|
SAXHandler()
This will create a new SAXHandler that listens to SAX
events and creates a JDOM Document. | |
SAXHandler(JDOMFactory factory)
This will create a new SAXHandler that listens to SAX
events and creates a JDOM Document. |
Method Summary | |
---|---|
void | attributeDecl(String eName, String aName, String type, String valueDefault, String value)
This handles an attribute declaration in the internal subset.
|
void | characters(char[] ch, int start, int length)
This will report character data (within an element).
|
void | comment(char[] ch, int start, int length)
This reports that a comments is parsed. |
void | elementDecl(String name, String model)
Handle an element declaration in a DTD.
|
void | endCDATA()
Report a CDATA section |
void | endDTD()
This signifies that the reading of the DTD is complete.
|
void | endElement(String namespaceURI, String localName, String qName)
Indicates the end of an element
( </[element name]> ) is reached. |
void | endEntity(String name)
if no current element, this entity belongs to an attribute
in these cases, it is an error on the part of the parser
to call startEntity but this will help in some cases.
|
void | externalEntityDecl(String name, String publicID, String systemID)
This is called when the parser encounters an external entity
declaration.
|
protected void | flushCharacters()
This will flush any characters from SAX character calls we've
been buffering.
|
protected void | flushCharacters(String data)
Flush the given string into the document. |
Element | getCurrentElement()
Returns the being-parsed element.
|
Document | getDocument()
Returns the document. |
Locator | getDocumentLocator()
Provides access to the {@link Locator} object provided by the
SAX parser.
|
boolean | getExpandEntities()
Returns whether or not entities will be expanded during the
build.
|
JDOMFactory | getFactory()
Returns the factory used for constructing objects.
|
boolean | getIgnoringElementContentWhitespace()
Returns whether or not the parser will elminate whitespace in
element content (sometimes known as "ignorable whitespace") when
building the document.
|
void | ignorableWhitespace(char[] ch, int start, int length)
Capture ignorable whitespace as text. |
void | internalEntityDecl(String name, String value)
Handle an internal entity declaration in a DTD.
|
void | notationDecl(String name, String publicID, String systemID)
Handle the declaration of a Notation in a DTD
|
void | processingInstruction(String target, String data)
This will indicate that a processing instruction has been encountered.
|
protected void | pushElement(Element element)
Pushes an element onto the tree under construction. |
void | setDocumentLocator(Locator locator)
Receives an object for locating the origin of SAX document
events. |
void | setExpandEntities(boolean expand)
This sets whether or not to expand entities during the build.
|
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. |
void | skippedEntity(String name)
This indicates that an unresolvable entity reference has been
encountered, normally because the external DTD subset has not been
read.
|
void | startCDATA()
Report a CDATA section
|
void | startDocument() |
void | startDTD(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.
|
void | startElement(String namespaceURI, String localName, String qName, Attributes atts)
This reports the occurrence of an actual element. |
void | startEntity(String name) |
void | startPrefixMapping(String prefix, String uri)
This will add the prefix mapping to the JDOM
Document object.
|
void | unparsedEntityDecl(String name, String publicID, String systemID, String notationName)
Handler for unparsed entity declarations in the DTD
|
SAXHandler
that listens to SAX
events and creates a JDOM Document. The objects will be constructed
using the default factory.SAXHandler
that listens to SAX
events and creates a JDOM Document. The objects will be constructed
using the provided factory.
Parameters: factory JDOMFactory
to be used for constructing
objects
Parameters: eName String
element name of attribute aName String
attribute name type String
attribute type valueDefault String
default value of attribute value String
value of attribute
Throws: SAXException
Parameters: ch char[]
character array with character data start int
index in array where data starts. length int
length of data.
Throws: SAXException
Element
, or the Document
itself
if at that level.
Parameters: ch ch[]
array of comment characters. start int
index to start reading from. length int
length of data.
Throws: SAXException
Parameters: name String
name of element model String
model of the element in DTD syntax
Throws: SAXException
Throws: SAXException
</[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 qName String
name of element in XML 1.0 form
Throws: SAXException when things go wrong
Parameters: name entity name publicID public id systemID system id
Throws: SAXException when things go wrong
Throws: SAXException when things go wrong
Parameters: data string to flush
Returns: Element
- element being built.
Throws: SAXException
Returns: Document
- Document that was built
Returns: Locator
an object that can return
the location of any SAX document event.
Returns: boolean
- whether entity expansion
will occur during build.
See Also: SAXHandler
Returns: JDOMFactory
- the factory used for
constructing objects.
See Also: SAXHandler
Returns: boolean
- whether ignorable whitespace will
be ignored during build.
See Also: SAXHandler
Parameters: ch []
- char array of ignorable whitespace start int
- starting position within array length int
- length of whitespace after start
Throws: SAXException when things go wrong
Parameters: name String
name of entity value String
value of the entity
Throws: SAXException
Parameters: name name of the notation publicID the public ID of the notation systemID the system ID of the notation
Parameters: target String
target of PI data String
containing all data sent to the PI.
This typically looks like one or more attribute value
pairs.
Throws: SAXException when things go wrong
Parameters: element root element under which content will be built
{@link org.jdom.JDOMFactory} implementations can use the {@link #getDocumentLocator} method to get access to the {@link Locator} during parse.
Parameters: locator Locator
an object that can return
the location of any SAX document event.
EntityRef
objects. The
default is true.
Parameters: expand boolean
indicating whether entity expansion
should occur.
false
.
Parameters: ignoringWhite Whether to ignore ignorable whitespace
Parameters: name String
name of entity
Throws: SAXException when things go wrong
Throws: SAXException
Document
object.
Parameters: name String
name of element listed in DTD publicID String
public ID of DTD systemID String
system ID of DTD
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
Document
object.
Parameters: prefix String
namespace prefix. uri String
namespace URI.
Parameters: name String
of the unparsed entity decl publicID String
of the unparsed entity decl systemID String
of the unparsed entity decl notationName String
of the unparsed entity decl