Main Page | Class Hierarchy | Class List | Class Members | Related Pages

org::jdom::input::SAXHandler Class Reference

List of all members.

Public Member Functions

 SAXHandler ()
 SAXHandler (JDOMFactory factory)
Document getDocument ()
JDOMFactory getFactory ()
void setExpandEntities (boolean expand)
boolean getExpandEntities ()
void setIgnoringElementContentWhitespace (boolean ignoringWhite)
boolean getIgnoringElementContentWhitespace ()
void externalEntityDecl (String name, String publicID, String systemID) throws SAXException
void attributeDecl (String eName, String aName, String type, String valueDefault, String value) throws SAXException
void elementDecl (String name, String model) throws SAXException
void internalEntityDecl (String name, String value) throws SAXException
void processingInstruction (String target, String data) throws SAXException
void skippedEntity (String name) throws SAXException
void startPrefixMapping (String prefix, String uri) throws SAXException
void startElement (String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
void characters (char[] ch, int start, int length) throws SAXException
void ignorableWhitespace (char[] ch, int start, int length) throws SAXException
void endElement (String namespaceURI, String localName, String qName) throws SAXException
void startDTD (String name, String publicID, String systemID) throws SAXException
void endDTD () throws SAXException
void startEntity (String name) throws SAXException
void endEntity (String name) throws SAXException
void startCDATA () throws SAXException
void endCDATA () throws SAXException
void comment (char[] ch, int start, int length) throws SAXException
void notationDecl (String name, String publicID, String systemID) throws SAXException
void unparsedEntityDecl (String name, String publicID, String systemID, String notationName) throws SAXException
void setDocumentLocator (Locator locator)
Locator getDocumentLocator ()

Protected Member Functions

void flushCharacters () throws SAXException
void appendExternalId (String publicID, String systemID)
Element getCurrentElement () throws SAXException

Protected Attributes

Element currentElement
boolean atRoot
boolean inDTD = false
boolean inInternalSubset = false
boolean previousCDATA = false
boolean inCDATA = false
boolean suppress = false
List declaredNamespaces

Static Package Functions

 [static initializer]

Detailed Description

SAXHandler supports SAXBuilder.

Author:
Brett McLaughlin

Jason Hunter

Philip Nelson

Bradley S. Huffman

phil@triloggroup.com

Version:
Revision
1.50
,
Date
2003/04/06 02:00:44


Constructor & Destructor Documentation

org::jdom::input::SAXHandler::SAXHandler  )  [inline]
 

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.

org::jdom::input::SAXHandler::SAXHandler JDOMFactory  factory  )  [inline]
 

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.

Parameters:
factory JDOMFactory to be used for constructing objects


Member Function Documentation

org::jdom::input::SAXHandler::[static initializer]  )  [inline, static, package]
 

Class initializer: Populate a table to translate SAX attribute type names into JDOM attribute type value (integer).

Note that all the mappings defined below are compliant with the SAX 2.0 specification exception for "ENUMERATION" with is specific to Crimson 1.1.X and Xerces 2.0.0-betaX which report attributes of enumerated types with a type "ENUMERATION" instead of the expected "NMTOKEN".

Note also that Xerces 1.4.X is not SAX 2.0 compliant either but handling its case requires specific code.

void org::jdom::input::SAXHandler::appendExternalId String  publicID,
String  systemID
[inline, protected]
 

Appends an external ID to the internal subset buffer. Either publicID or systemID may be null, but not both.

Parameters:
publicID the public ID
systemID the system ID

void org::jdom::input::SAXHandler::attributeDecl String  eName,
String  aName,
String  type,
String  valueDefault,
String  value
throws SAXException [inline]
 

This handles an attribute declaration in the internal subset.

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

void org::jdom::input::SAXHandler::characters char[]  ch,
int  start,
int  length
throws SAXException [inline]
 

This will report character data (within an element).

Parameters:
ch char[] character array with character data
start int index in array where data starts.
length int length of data.

void org::jdom::input::SAXHandler::comment char[]  ch,
int  start,
int  length
throws SAXException [inline]
 

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.

Parameters:
ch ch[] array of comment characters.
start int index to start reading from.
length int length of data.

void org::jdom::input::SAXHandler::elementDecl String  name,
String  model
throws SAXException [inline]
 

Handle an element declaration in a DTD.

Parameters:
name String name of element
model String model of the element in DTD syntax

void org::jdom::input::SAXHandler::endCDATA  )  throws SAXException [inline]
 

Report a CDATA section - ignored in SAXBuilder.

void org::jdom::input::SAXHandler::endDTD  )  throws SAXException [inline]
 

This signifies that the reading of the DTD is complete.

void org::jdom::input::SAXHandler::endElement String  namespaceURI,
String  localName,
String  qName
throws SAXException [inline]
 

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.

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
Exceptions:
SAXException when things go wrong

void org::jdom::input::SAXHandler::externalEntityDecl String  name,
String  publicID,
String  systemID
throws SAXException [inline]
 

This is called when the parser encounters an external entity declaration.

Parameters:
name entity name
publicID public id
systemID system id
Exceptions:
SAXException when things go wrong

void org::jdom::input::SAXHandler::flushCharacters  )  throws SAXException [inline, protected]
 

This will flush any characters from SAX character calls we've been buffering.

Exceptions:
SAXException when things go wrong

This is commented out because of some problems with the inline DTDs that Xerces seems to have. if (!inDTD) { if (inEntity) { getCurrentElement().setContent(factory.text(data)); } else { getCurrentElement().addContent(factory.text(data)); }

Element org::jdom::input::SAXHandler::getCurrentElement  )  throws SAXException [inline, protected]
 

Returns the being-parsed element.

Returns:
Element - element being built.

Document org::jdom::input::SAXHandler::getDocument  )  [inline]
 

Returns the document. Should be called after parsing is complete.

Returns:
Document - Document that was built

Locator org::jdom::input::SAXHandler::getDocumentLocator  )  [inline]
 

Provides access to the Locator object provided by the SAX parser.

Returns:
Locator an object that can return the location of any SAX document event.

boolean org::jdom::input::SAXHandler::getExpandEntities  )  [inline]
 

Returns whether or not entities will be expanded during the build.

Returns:
boolean - whether entity expansion will occur during build.
See also:
setExpandEntities

JDOMFactory org::jdom::input::SAXHandler::getFactory  )  [inline]
 

Returns the factory used for constructing objects.

Returns:
JDOMFactory - the factory used for constructing objects.
See also:
SAXHandler(org.jdom.input.JDOMFactory)

boolean org::jdom::input::SAXHandler::getIgnoringElementContentWhitespace  )  [inline]
 

Returns whether or not the parser will elminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document.

Returns:
boolean - whether ignorable whitespace will be ignored during build.
See also:
setIgnoringElementContentWhitespace

void org::jdom::input::SAXHandler::ignorableWhitespace char[]  ch,
int  start,
int  length
throws SAXException [inline]
 

Capture ignorable whitespace as text. If setIgnoringElementContentWhitespace(true) has been called then this method does nothing.

Parameters:
ch [] - char array of ignorable whitespace
start int - starting position within array
length int - length of whitespace after start
Exceptions:
SAXException when things go wrong

void org::jdom::input::SAXHandler::internalEntityDecl String  name,
String  value
throws SAXException [inline]
 

Handle an internal entity declaration in a DTD.

Parameters:
name String name of entity
value String value of the entity

void org::jdom::input::SAXHandler::notationDecl String  name,
String  publicID,
String  systemID
throws SAXException [inline]
 

Handle the declaration of a Notation in a DTD

Parameters:
name name of the notation
publicID the public ID of the notation
systemID the system ID of the notation

void org::jdom::input::SAXHandler::processingInstruction String  target,
String  data
throws SAXException [inline]
 

This will indicate that a processing instruction has been encountered. (The XML declaration is not a processing instruction and will not be reported.)

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.
Exceptions:
SAXException when things go wrong

void org::jdom::input::SAXHandler::setDocumentLocator Locator  locator  )  [inline]
 

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.

Parameters:
locator Locator an object that can return the location of any SAX document event.

void org::jdom::input::SAXHandler::setExpandEntities boolean  expand  )  [inline]
 

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.

Parameters:
expand boolean indicating whether entity expansion should occur.

void org::jdom::input::SAXHandler::setIgnoringElementContentWhitespace boolean  ignoringWhite  )  [inline]
 

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.

Parameters:
ignoringWhite Whether to ignore ignorable whitespace

void org::jdom::input::SAXHandler::skippedEntity String  name  )  throws SAXException [inline]
 

This indicates that an unresolvable entity reference has been encountered, normally because the external DTD subset has not been read.

Parameters:
name String name of entity
Exceptions:
SAXException when things go wrong

void org::jdom::input::SAXHandler::startCDATA  )  throws SAXException [inline]
 

Report a CDATA section - ignored in SAXBuilder.

void org::jdom::input::SAXHandler::startDTD String  name,
String  publicID,
String  systemID
throws SAXException [inline]
 

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.

Parameters:
name String name of element listed in DTD
publicID String public ID of DTD
systemID String system ID of DTD

void org::jdom::input::SAXHandler::startElement String  namespaceURI,
String  localName,
String  qName,
Attributes  atts
throws SAXException [inline]
 

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.

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
Exceptions:
SAXException when things go wrong

void org::jdom::input::SAXHandler::startEntity String  name  )  throws SAXException [inline]
 

void org::jdom::input::SAXHandler::startPrefixMapping String  prefix,
String  uri
throws SAXException [inline]
 

This will add the prefix mapping to the JDOM Document object.

Parameters:
prefix String namespace prefix.
uri String namespace URI.

void org::jdom::input::SAXHandler::unparsedEntityDecl String  name,
String  publicID,
String  systemID,
String  notationName
throws SAXException [inline]
 

Handler for unparsed entity declarations in the DTD

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


Member Data Documentation

boolean org::jdom::input::SAXHandler::atRoot [protected]
 

Indicator of where in the document we are

Element org::jdom::input::SAXHandler::currentElement [protected]
 

Element object being built

List org::jdom::input::SAXHandler::declaredNamespaces [protected]
 

Temporary holder for namespaces that have been declared with startPrefixMapping, but are not yet available on the element

boolean org::jdom::input::SAXHandler::inCDATA = false [protected]
 

Indicator of whether we are in a CDATA

boolean org::jdom::input::SAXHandler::inDTD = false [protected]
 

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).

boolean org::jdom::input::SAXHandler::inInternalSubset = false [protected]
 

Indicator of whether we are in the internal subset

boolean org::jdom::input::SAXHandler::previousCDATA = false [protected]
 

Indicator of whether we previously where in a CDATA

boolean org::jdom::input::SAXHandler::suppress = false [protected]
 

Indicator of whether we are actively suppressing (non-expanding) a current entity


The documentation for this class was generated from the following file:
Generated on Wed Jul 7 01:03:20 2004 for JDOM by doxygen 1.3.7