attributeDecl
public void attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
throws SAXException
This handles an attribute declaration in the internal subset.
eName
- String
element name of attributeaName
- String
attribute nametype
- String
attribute typevalueDefault
- String
default value of attributevalue
- String
value of attribute
characters
public void characters(char[] ch,
int start,
int length)
throws SAXException
This will report character data (within an element).
ch
- char[]
character array with character datastart
- int
index in array where data starts.length
- int
length of data.
comment
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
- ch[]
array of comment characters.start
- int
index to start reading from.length
- int
length of data.
elementDecl
public void elementDecl(String name,
String model)
throws SAXException
Handle an element declaration in a DTD.
name
- String
name of elementmodel
- String
model of the element in DTD syntax
endCDATA
public void endCDATA()
throws SAXException
Report a CDATA section
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 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.
namespaceURI
- String
URI of namespace this
element is associated withlocalName
- String
name of element without prefixqName
- String
name of element in XML 1.0 form
endEntity
public void endEntity(String name)
throws SAXException
externalEntityDecl
public void externalEntityDecl(String name,
String publicID,
String systemID)
throws SAXException
This is called when the parser encounters an external entity
declaration.
name
- entity namepublicID
- public idsystemID
- system id
flushCharacters
protected void flushCharacters()
throws SAXException
This will flush any characters from SAX character calls we've
been buffering.
flushCharacters
protected void flushCharacters(String data)
throws SAXException
Flush the given string into the document. This is a protected method
so subclassers can control text handling without knowledge of the
internals of this class.
getCurrentElement
public Element getCurrentElement()
throws SAXException
Returns the being-parsed element.
Element
- element being built.
getDocument
public Document getDocument()
Returns the document. Should be called after parsing is complete.
Document
- Document that was built
getDocumentLocator
public Locator getDocumentLocator()
Provides access to the Locator
object provided by the
SAX parser.
Locator
an object that can return
the location of any SAX document event.
getExpandEntities
public boolean getExpandEntities()
Returns whether or not entities will be expanded during the
build.
boolean
- whether entity expansion
will occur during build.
getFactory
public JDOMFactory getFactory()
Returns the factory used for constructing objects.
JDOMFactory
- the factory used for
constructing objects.
getIgnoringBoundaryWhitespace
public boolean getIgnoringBoundaryWhitespace()
Returns whether or not the parser will elminate element content
containing only whitespace.
boolean
- whether only whitespace content will
be ignored during build.
getIgnoringElementContentWhitespace
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.
ignorableWhitespace
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.
ch
- []
- char array of ignorable whitespacestart
- int
- starting position within arraylength
- int
- length of whitespace after start
internalEntityDecl
public void internalEntityDecl(String name,
String value)
throws SAXException
Handle an internal entity declaration in a DTD.
name
- String
name of entityvalue
- String
value of the entity
notationDecl
public void notationDecl(String name,
String publicID,
String systemID)
throws SAXException
Handle the declaration of a Notation in a DTD
name
- name of the notationpublicID
- the public ID of the notationsystemID
- the system ID of the notation
processingInstruction
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.)
target
- String
target of PIdata
- String
containing all data sent to the PI.
This typically looks like one or more attribute value
pairs.
pushElement
protected void pushElement(Element element)
Pushes an element onto the tree under construction. Allows subclasses
to put content under a dummy root element which is useful for building
content that would otherwise be a non-well formed document.
element
- root element under which content will be built
setDocumentLocator
public void setDocumentLocator(Locator locator)
Receives an object for locating the origin of SAX document
events. This method is invoked by the SAX parser.
JDOMFactory
implementations can use the
getDocumentLocator()
method to get access to the
Locator
during parse.
locator
- Locator
an object that can return
the location of any SAX document event.
setExpandEntities
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.
expand
- boolean
indicating whether entity expansion
should occur.
setIgnoringBoundaryWhitespace
public void setIgnoringBoundaryWhitespace(boolean ignoringBoundaryWhite)
ignoringBoundaryWhite
- Whether to ignore only whitespace content
setIgnoringElementContentWhitespace
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
.
ignoringWhite
- Whether to ignore ignorable whitespace
skippedEntity
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.
name
- String
name of entity
startCDATA
public void startCDATA()
throws SAXException
Report a CDATA section
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.
name
- String
name of element listed in DTDpublicID
- String
public ID of DTDsystemID
- String
system ID of DTD
startDocument
public void startDocument()
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
.
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
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.
prefix
- String
namespace prefix.uri
- String
namespace URI.
unparsedEntityDecl
public void unparsedEntityDecl(String name,
String publicID,
String systemID,
String notationName)
throws SAXException
Handler for unparsed entity declarations in the DTD
name
- String
of the unparsed entity declpublicID
- String
of the unparsed entity declsystemID
- String
of the unparsed entity declnotationName
- String
of the unparsed entity decl