SAXBuilder.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | atRoot
Indicator of where in the document we are |
| private static final Map | attrNameToTypeMap
Hash table to map SAX attribute type names to JDOM attribute types. |
| private Element | currentElement
|
| private static final String | |
| private List | declaredNamespaces
Temporary holder for namespaces that have been declared with startPrefixMapping, but are not yet available on the element |
| private Document | document
|
| private int | entityDepth
How many nested entities we're currently within |
| private boolean | expand
Indicator of whether we should expand entities |
| private Map | externalEntities
The external entities defined in this document |
| private JDOMFactory | factory
The JDOMFactory used for JDOM object creation |
| private boolean | ignoringBoundaryWhite
Whether to ignore text containing all whitespace |
| private boolean | ignoringWhite
Whether to ignore ignorable whitespace |
| private boolean | inCDATA
Indicator of whether we are in a CDATA |
| private boolean | inDTD
Indicator of whether we are in the DocType. |
| private boolean | inInternalSubset
Indicator of whether we are in the internal subset |
| private StringBuffer | internalSubset
Temporary holder for the internal subset |
| private Locator | locator
The SAX Locator object provided by the parser |
| private boolean | previousCDATA
Indicator of whether we previously were in a CDATA |
| private boolean | suppress
Indicator of whether we are actively suppressing (non-expanding) a current entity |
| private TextBuffer | textBuffer
Temporary holder for Text and CDATA |
| Access | Constructor and Description |
|---|---|
| public | SAXHandler()
This will create a new |
| public | SAXHandler(JDOMFactory
JDOMFactory to be used for constructing
objectsThis will create a new |
| Modifier and Type | Method and Description |
|---|---|
| private void | appendExternalId(String
the public ID publicID, String the system ID systemID)Appends an external ID to the internal subset buffer. |
| public void | attributeDecl(String
String element name of attributeString attribute nameString attribute typeString default value of attributeString value of attributeImplements org. |
| public void | characters(char[]
char[] character array with character dataint index in array where data starts.int length of data.Overrides org. Implements org. |
| public void | comment(char[]
ch[] array of comment characters.int index to start reading from.int length of data.Implements org. |
| public void | elementDecl(String
String name of elementString model of the element in DTD syntaxImplements org. |
| public void | |
| public void | endDTD()
Implements org. |
| public void | endElement(String
String URI of namespace this
element is associated withString name of element without prefixString name of element in XML 1.0 formOverrides org. Implements org. </[element name]>) is reached.
|
| public void | endEntity(String
The name of the entity that is ending. name)Implements org. |
| public void | externalEntityDecl(String
entity name name, String public id publicID, String system id systemID)Implements org. |
| protected void | |
| protected void | |
| private static int | Returns: int the JDOM attribute type.String the SAX 2.0 attribute
type string.Returns the the JDOM Attribute type value from the SAX 2.0 attribute type string provided by the parser. |
| public Element | |
| public Document | |
| public Locator | Returns: Locator an object that can return
the location of any SAX document event.Provides access to the |
| public boolean | Returns: boolean - whether entity expansion
will occur during build.Returns whether or not entities will be expanded during the build. |
| public JDOMFactory | Returns: JDOMFactory - the factory used for
constructing objects.Returns the factory used for constructing objects. |
| public boolean | Returns: boolean - whether only whitespace content will
be ignored during build.Returns whether or not the parser will elminate element content containing only whitespace. |
| public boolean | Returns: boolean - whether ignorable whitespace will
be ignored during build.Returns whether or not the parser will elminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document. |
| public void | ignorableWhitespace(char[]
[] - char array of ignorable whitespaceint - starting position within arrayint - length of whitespace after startOverrides org. Implements org. |
| public void | internalEntityDecl(String
String name of entityString value of the entityImplements org. |
| public void | notationDecl(String
name of the notation name, String the public ID of the notation publicID, String the system ID of the notation systemID)Overrides org. Implements org. |
| public void | processingInstruction(String
String target of PIString containing all data sent to the PI.
This typically looks like one or more attribute value
pairs.Overrides org. Implements org. |
| protected void | pushElement(Element
root element under which content will be built element)Pushes an element onto the tree under construction. |
| public void | setDocumentLocator(Locator
Locator an object that can return
the location of any SAX document event.Overrides org. Implements org. |
| public void | setExpandEntities(boolean
boolean indicating whether entity expansion
should occur.This sets whether or not to expand entities during the build. |
| public void | setIgnoringBoundaryWhitespace(boolean
Whether to ignore only whitespace content ignoringBoundaryWhite)Specifies whether or not the parser should elminate text() nodes containing only whitespace when building the document. |
| public void | setIgnoringElementContentWhitespace(boolean
Whether to ignore ignorable whitespace ignoringWhite)Specifies whether or not the parser should elminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document. |
| public void | skippedEntity(String
String name of entityOverrides org. Implements org. |
| public void | |
| public void | startDocument()
Overrides org. Implements org. |
| public void | startDTD(String
String name of element listed in DTDString public ID of DTDString system ID of DTDImplements org. Document
object.
|
| public void | startElement(String
String namespace URI this element
is associated with, or an empty
StringString 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 elementOverrides org. Implements org. |
| public void | startEntity(String
The name of the entity. If it is a parameter
entity, the name will begin with '%', and if it is the
external DTD subset, it will be "[dtd]". name)Implements org. |
| public void | startPrefixMapping(String
String namespace prefix.String namespace URI.Overrides org. Implements org. Document object.
|
| private void | transferNamespaces(Element
Element to read namespaces from.This will take the supplied |
| public void | unparsedEntityDecl(String
String of the unparsed entity declString of the unparsed entity declString of the unparsed entity declString of the unparsed entity declOverrides org. Implements org. |
| atRoot | back to summary |
|---|---|
| private boolean atRoot Indicator of where in the document we are | |
| attrNameToTypeMap | back to summary |
|---|---|
| private static final Map<K, V> attrNameToTypeMap Hash table to map SAX attribute type names to JDOM attribute types. | |
| currentElement | back to summary |
|---|---|
| private Element currentElement
| |
| CVS_ID | back to summary |
|---|---|
| private static final String CVS_ID | |
| declaredNamespaces | back to summary |
|---|---|
| private List<E> declaredNamespaces Temporary holder for namespaces that have been declared with startPrefixMapping, but are not yet available on the element | |
| document | back to summary |
|---|---|
| private Document document
| |
| entityDepth | back to summary |
|---|---|
| private int entityDepth How many nested entities we're currently within | |
| expand | back to summary |
|---|---|
| private boolean expand Indicator of whether we should expand entities | |
| externalEntities | back to summary |
|---|---|
| private Map<K, V> externalEntities The external entities defined in this document | |
| factory | back to summary |
|---|---|
| private JDOMFactory factory The JDOMFactory used for JDOM object creation | |
| ignoringBoundaryWhite | back to summary |
|---|---|
| private boolean ignoringBoundaryWhite Whether to ignore text containing all whitespace | |
| ignoringWhite | back to summary |
|---|---|
| private boolean ignoringWhite Whether to ignore ignorable whitespace | |
| inCDATA | back to summary |
|---|---|
| private boolean inCDATA Indicator of whether we are in a CDATA | |
| inDTD | back to summary |
|---|---|
| private boolean inDTD Indicator of whether we are in the DocType. Note that the DTD consists of both the internal subset (inside the <!DOCTYPE> tag) and the external subset (in a separate .dtd file). | |
| inInternalSubset | back to summary |
|---|---|
| private boolean inInternalSubset Indicator of whether we are in the internal subset | |
| internalSubset | back to summary |
|---|---|
| private StringBuffer internalSubset Temporary holder for the internal subset | |
| locator | back to summary |
|---|---|
| private Locator locator The SAX Locator object provided by the parser | |
| previousCDATA | back to summary |
|---|---|
| private boolean previousCDATA Indicator of whether we previously were in a CDATA | |
| suppress | back to summary |
|---|---|
| private boolean suppress Indicator of whether we are actively suppressing (non-expanding) a current entity | |
| textBuffer | back to summary |
|---|---|
| private TextBuffer textBuffer Temporary holder for Text and CDATA | |
| SAXHandler | back to summary |
|---|---|
| public SAXHandler() This will create a new | |
| SAXHandler | back to summary |
|---|---|
| public SAXHandler(JDOMFactory factory) This will create a new
| |
| appendExternalId | back to summary |
|---|---|
| private 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. | |
| attributeDecl | back to summary |
|---|---|
| public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException Implements org. This handles an attribute declaration in the internal subset.
| |
| characters | back to summary |
|---|---|
| public void characters(char[] ch, int start, int length) throws SAXException Overrides org. Implements org. This will report character data (within an element).
| |
| comment | back to summary |
|---|---|
| public void comment(char[] ch, int start, int length) throws SAXException Implements org. This reports that a comments is parsed. If not in the
DTD, this comment is added to the current JDOM
| |
| elementDecl | back to summary |
|---|---|
| public void elementDecl(String name, String model) throws SAXException Implements org. Handle an element declaration in a DTD.
| |
| endCDATA | back to summary |
|---|---|
| public void endCDATA() throws SAXException Implements org. Report a CDATA section
| |
| endDTD | back to summary |
|---|---|
| public void endDTD() throws SAXException Implements org. This signifies that the reading of the DTD is complete.
| |
| endElement | back to summary |
|---|---|
| public void endElement(String namespaceURI, String localName, String qName) throws SAXException Overrides org. Implements org. Indicates the end of an element
(
| |
| endEntity | back to summary |
|---|---|
| public void endEntity(String name) throws SAXException Implements org. Doc from org. Report the end of an entity.
| |
| externalEntityDecl | back to summary |
|---|---|
| public void externalEntityDecl(String name, String publicID, String systemID) throws SAXException Implements org. This is called when the parser encounters an external entity declaration.
| |
| flushCharacters | back to summary |
|---|---|
| protected void flushCharacters() throws SAXException This will flush any characters from SAX character calls we've been buffering.
| |
| flushCharacters | back to summary |
|---|---|
| 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.
| |
| getAttributeType | back to summary |
|---|---|
| private static int getAttributeType(String typeName) Returns the the JDOM Attribute type value from the SAX 2.0 attribute type string provided by the parser.
| |
| getCurrentElement | back to summary |
|---|---|
| public Element getCurrentElement() throws SAXException Returns the being-parsed element.
| |
| getDocument | back to summary |
|---|---|
| public Document getDocument() Returns the document. Should be called after parsing is complete.
| |
| getDocumentLocator | back to summary |
|---|---|
| public Locator getDocumentLocator() Provides access to the
| |
| getExpandEntities | back to summary |
|---|---|
| public boolean getExpandEntities() Returns whether or not entities will be expanded during the build.
| |
| getFactory | back to summary |
|---|---|
| public JDOMFactory getFactory() Returns the factory used for constructing objects.
| |
| getIgnoringBoundaryWhitespace | back to summary |
|---|---|
| public boolean getIgnoringBoundaryWhitespace() Returns whether or not the parser will elminate element content containing only whitespace.
| |
| getIgnoringElementContentWhitespace | back to summary |
|---|---|
| public boolean getIgnoringElementContentWhitespace() Returns whether or not the parser will elminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document.
| |
| ignorableWhitespace | back to summary |
|---|---|
| public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException Overrides org. Implements org. Capture ignorable whitespace as text. If setIgnoringElementContentWhitespace(true) has been called then this method does nothing.
| |
| internalEntityDecl | back to summary |
|---|---|
| public void internalEntityDecl(String name, String value) throws SAXException Implements org. Handle an internal entity declaration in a DTD.
| |
| notationDecl | back to summary |
|---|---|
| public void notationDecl(String name, String publicID, String systemID) throws SAXException Overrides org. Implements org. Handle the declaration of a Notation in a DTD
| |
| processingInstruction | back to summary |
|---|---|
| public void processingInstruction(String target, String data) throws SAXException Overrides org. Implements org. This will indicate that a processing instruction has been encountered. (The XML declaration is not a processing instruction and will not be reported.)
| |
| pushElement | back to summary |
|---|---|
| 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.
| |
| setDocumentLocator | back to summary |
|---|---|
| public void setDocumentLocator(Locator locator) Overrides org. Implements org. Receives an object for locating the origin of SAX document events. This method is invoked by the SAX parser.
| |
| setExpandEntities | back to summary |
|---|---|
| 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
| |
| setIgnoringBoundaryWhitespace | back to summary |
|---|---|
| public void setIgnoringBoundaryWhitespace(boolean ignoringBoundaryWhite) Specifies whether or not the parser should elminate text() nodes
containing only whitespace when building the document. See
| |
| setIgnoringElementContentWhitespace | back to summary |
|---|---|
| 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
| |
| skippedEntity | back to summary |
|---|---|
| public void skippedEntity(String name) throws SAXException Overrides org. Implements org. This indicates that an unresolvable entity reference has been encountered, normally because the external DTD subset has not been read.
| |
| startCDATA | back to summary |
|---|---|
| public void startCDATA() throws SAXException Implements org. Report a CDATA section
| |
| startDocument | back to summary |
|---|---|
| public void startDocument() Overrides org. Implements org. Doc from org. Receive notification of the beginning of the document. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file). | |
| startDTD | back to summary |
|---|---|
| public void startDTD(String name, String publicID, String systemID) throws SAXException Implements org. 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
| |
| startElement | back to summary |
|---|---|
| public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException Overrides org. Implements org. 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
| |
| startEntity | back to summary |
|---|---|
| public void startEntity(String name) throws SAXException Implements org. Doc from org. Report the beginning of some internal and external XML entities. The reporting of parameter entities (including
the external DTD subset) is optional, and SAX2 drivers that
report LexicalHandler events may not implement it; you can use the
General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]". When a SAX2 driver is providing these events, all other
events must be properly nested within start/end entity
events. There is no additional requirement that events from
Note that skipped entities will be reported through the
Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:
These will be silently expanded, with no indication of where the original entity boundaries were. Note also that the boundaries of character references (which are not really entities anyway) are not reported. All start/endEntity events must be properly nested.
| |
| startPrefixMapping | back to summary |
|---|---|
| public void startPrefixMapping(String prefix, String uri) throws SAXException Overrides org. Implements org. This will add the prefix mapping to the JDOM
| |
| transferNamespaces | back to summary |
|---|---|
| private void transferNamespaces(Element element) This will take the supplied
| |
| unparsedEntityDecl | back to summary |
|---|---|
| public void unparsedEntityDecl(String name, String publicID, String systemID, String notationName) throws SAXException Overrides org. Implements org. Handler for unparsed entity declarations in the DTD
| |