org::jdom::input::SAXBuilder Class Reference

List of all members.

Public Member Functions

 SAXBuilder ()
 SAXBuilder (boolean validate)
 SAXBuilder (String saxDriverClass)
 SAXBuilder (String saxDriverClass, boolean validate)
void setFactory (JDOMFactory factory)
void setValidation (boolean validate)
void setErrorHandler (ErrorHandler errorHandler)
void setEntityResolver (EntityResolver entityResolver)
void setDTDHandler (DTDHandler dtdHandler)
void setXMLFilter (XMLFilter xmlFilter)
void setIgnoringElementContentWhitespace (boolean ignoringWhite)
void setReuseParser (boolean reuseParser)
void setFeature (String name, boolean value)
void setProperty (String name, Object value)
Document build (InputSource in) throws JDOMException, IOException
Document build (InputStream in) throws JDOMException, IOException
Document build (File file) throws JDOMException, IOException
Document build (URL url) throws JDOMException, IOException
Document build (InputStream in, String systemId) throws JDOMException, IOException
Document build (Reader characterStream) throws JDOMException, IOException
Document build (Reader characterStream, String systemId) throws JDOMException, IOException
Document build (String systemId) throws JDOMException, IOException
void setExpandEntities (boolean expand)

Protected Member Functions

SAXHandler createContentHandler ()
void configureContentHandler (SAXHandler contentHandler)
XMLReader createParser () throws JDOMException
void configureParser (XMLReader parser, SAXHandler contentHandler) throws JDOMException
URL fileToURL (File f) throws MalformedURLException

Protected Attributes

JDOMFactory factory = null

Detailed Description

SAXBuilder builds a JDOM tree using SAX. Information about SAX can be found at http://www.saxproject.org.

Known issues: Relative paths for a DocType or EntityRef may be converted by the SAX parser into absolute paths.

Author:
Jason Hunter

Brett McLaughlin

Dan Schaffer

Philip Nelson

Alex Rosen

Version:
Revision
1.75
,
Date
2003/04/10 04:38:47


Constructor & Destructor Documentation

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

Creates a new SAXBuilder which will attempt to first locate a parser via JAXP, then will try to use a set of default SAX Drivers. The underlying parser will not validate.

org::jdom::input::SAXBuilder::SAXBuilder boolean  validate  )  [inline]
 

Creates a new SAXBuilder which will attempt to first locate a parser via JAXP, then will try to use a set of default SAX Drivers. The underlying parser will validate or not according to the given parameter.

Parameters:
validate boolean indicating if validation should occur.

org::jdom::input::SAXBuilder::SAXBuilder String  saxDriverClass  )  [inline]
 

Creates a new SAXBuilder using the specified SAX parser. The underlying parser will not validate.

Parameters:
saxDriverClass String name of SAX Driver to use for parsing.

org::jdom::input::SAXBuilder::SAXBuilder String  saxDriverClass,
boolean  validate
[inline]
 

Creates a new SAXBuilder using the specified SAX parser. The underlying parser will validate or not according to the given parameter.

Parameters:
saxDriverClass String name of SAX Driver to use for parsing.
validate boolean indicating if validation should occur.


Member Function Documentation

Document org::jdom::input::SAXBuilder::build String  systemId  )  throws JDOMException, IOException [inline]
 

This builds a document from the supplied URI.

Parameters:
systemId URI for the input
Returns:
Document - resultant Document object.
Exceptions:
JDOMException when errors occur in parsing.
IOException when an I/O error prevents a document from being fully parsed.

Document org::jdom::input::SAXBuilder::build Reader  characterStream,
String  systemId
throws JDOMException, IOException [inline]
 

This builds a document from the supplied Reader. It's the programmer's responsibility to make sure the reader matches the encoding of the file. It's always safer to use an InputStream rather than a Reader, if it's available.

Parameters:
characterStream Reader to read from.
systemId base for resolving relative URIs
Returns:
Document - resultant Document object.
Exceptions:
JDOMException when errors occur in parsing.
IOException when an I/O error prevents a document from being fully parsed.

Document org::jdom::input::SAXBuilder::build Reader  characterStream  )  throws JDOMException, IOException [inline]
 

This builds a document from the supplied Reader. It's the programmer's responsibility to make sure the reader matches the encoding of the file. It's always safer to use an InputStream rather than a Reader, if it's available.

Parameters:
characterStream Reader to read from.
Returns:
Document - resultant Document object.
Exceptions:
JDOMException when errors occur in parsing.
IOException when an I/O error prevents a document from being fully parsed.

Document org::jdom::input::SAXBuilder::build InputStream  in,
String  systemId
throws JDOMException, IOException [inline]
 

This builds a document from the supplied input stream.

Parameters:
in InputStream to read from.
systemId base for resolving relative URIs
Returns:
Document - resultant Document object.
Exceptions:
JDOMException when errors occur in parsing.
IOException when an I/O error prevents a document from being fully parsed.

Document org::jdom::input::SAXBuilder::build URL  url  )  throws JDOMException, IOException [inline]
 

This builds a document from the supplied URL.

Parameters:
url URL to read from.
Returns:
Document - resultant Document object.
Exceptions:
JDOMException when errors occur in parsing.
IOException when an I/O error prevents a document from being fully parsed.

Document org::jdom::input::SAXBuilder::build File  file  )  throws JDOMException, IOException [inline]
 

This builds a document from the supplied filename.

Parameters:
file File to read from.
Returns:
Document - resultant Document object.
Exceptions:
JDOMException when errors occur in parsing.
IOException when an I/O error prevents a document from being fully parsed.

Document org::jdom::input::SAXBuilder::build InputStream  in  )  throws JDOMException, IOException [inline]
 

This builds a document from the supplied input stream.

Parameters:
in InputStream to read from.
Returns:
Document - resultant Document object.
Exceptions:
JDOMException when errors occur in parsing.
IOException when an I/O error prevents a document from being fully parsed.

Document org::jdom::input::SAXBuilder::build InputSource  in  )  throws JDOMException, IOException [inline]
 

This builds a document from the supplied input source.

Parameters:
in InputSource to read from.
Returns:
Document - resultant Document object.
Exceptions:
JDOMException when errors occur in parsing.
IOException when an I/O error prevents a document from being fully parsed.

void org::jdom::input::SAXBuilder::configureContentHandler SAXHandler  contentHandler  )  [inline, protected]
 

This configures the SAXHandler that will be used to build the Document.

The default implementation simply passes through some configuration settings that were set on the SAXBuilder: setExpandEntities() and setIgnoringElementContentWhitespace().

void org::jdom::input::SAXBuilder::configureParser XMLReader  parser,
SAXHandler  contentHandler
throws JDOMException [inline, protected]
 

This configures the XMLReader to be used for reading the XML document.

The default implementation sets various options on the given XMLReader, such as validation, DTD resolution, entity handlers, etc., according to the options that were set (e.g. via setEntityResolver) and set various SAX properties and features that are required for JDOM internals. These features may change in future releases, so change this behavior at your own risk.

SAXHandler org::jdom::input::SAXBuilder::createContentHandler  )  [inline, protected]
 

This creates the SAXHandler that will be used to build the Document.

Returns:
SAXHandler - resultant SAXHandler object.

XMLReader org::jdom::input::SAXBuilder::createParser  )  throws JDOMException [inline, protected]
 

This creates the XMLReader to be used for reading the XML document.

The default behavior is to (1) use the saxDriverClass, if it has been set, (2) try to obtain a parser from JAXP, if it is available, and (3) if all else fails, use a hard-coded default parser (currently the Xerces parser). Subclasses may override this method to determine the parser to use in a different way.

Returns:
XMLReader - resultant XMLReader object.

URL org::jdom::input::SAXBuilder::fileToURL File  f  )  throws MalformedURLException [inline, protected]
 

Imitation of File.toURL(), a JDK 1.2 method, reimplemented here to work with JDK 1.1.

See also:
java.io.File
Parameters:
f the file to convert
Returns:
the file path converted to a file: URL

void org::jdom::input::SAXBuilder::setDTDHandler DTDHandler  dtdHandler  )  [inline]
 

This sets custom DTDHandler for the Builder.

Parameters:
dtdHandler DTDHandler

void org::jdom::input::SAXBuilder::setEntityResolver EntityResolver  entityResolver  )  [inline]
 

This sets custom EntityResolver for the Builder.

Parameters:
entityResolver EntityResolver

void org::jdom::input::SAXBuilder::setErrorHandler ErrorHandler  errorHandler  )  [inline]
 

This sets custom ErrorHandler for the Builder.

Parameters:
errorHandler ErrorHandler

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

This sets whether or not to expand entities for the builder. A true means to expand entities as normal content. A false means to leave entities unexpanded as EntityRef objects. The default is true.

When this setting is false, the internal DTD subset is retained; when this setting is true, the internal DTD subset is not retained.

Note that Xerces (at least up to 1.4.4) has a bug where entities in attribute values will be misreported if this flag is turned off, resulting in entities to appear within element content. When turning entity expansion off either avoid entities in attribute values, or use another parser like Crimson. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6111

Parameters:
expand boolean indicating whether entity expansion should occur.

void org::jdom::input::SAXBuilder::setFeature String  name,
boolean  value
[inline]
 

This sets a feature on the SAX parser. See the SAX documentation for

NOTE: SAXBuilder requires that some particular features of the SAX parser be set up in certain ways for it to work properly. The list of such features may change in the future. Therefore, the use of this method may cause parsing to break, and even if it doesn't break anything today it might break parsing in a future JDOM version, because what JDOM parsers require may change over time. Use with caution.

Parameters:
name The feature name, which is a fully-qualified URI.
value The requested state of the feature (true or false).

void org::jdom::input::SAXBuilder::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::SAXBuilder::setProperty String  name,
Object  value
[inline]
 

This sets a property on the SAX parser. See the SAX documentation for more information.

NOTE: SAXBuilder requires that some particular properties of the SAX parser be set up in certain ways for it to work properly. The list of such properties may change in the future. Therefore, the use of this method may cause parsing to break, and even if it doesn't break anything today it might break parsing in a future JDOM version, because what JDOM parsers require may change over time. Use with caution.

Parameters:
name The property name, which is a fully-qualified URI.
value The requested value for the property.

void org::jdom::input::SAXBuilder::setReuseParser boolean  reuseParser  )  [inline]
 

Specifies whether this builder shall reuse the same SAX parser when performing subsequent parses or allocate a new parser for each parse. The default value of this setting is false (i.e. no parser reuse).

Note: As SAX parser instances may not be used in multiple threads running concurrently, the parser reuse feature shall not be used with SAXBuilder instances shared among threads.

Parameters:
reuseParser Whether to reuse the SAX parser.

void org::jdom::input::SAXBuilder::setValidation boolean  validate  )  [inline]
 

This sets validation for the builder.

Parameters:
validate boolean indicating whether validation should occur.

void org::jdom::input::SAXBuilder::setXMLFilter XMLFilter  xmlFilter  )  [inline]
 

This sets custom XMLFilter for the Builder.

Parameters:
xmlFilter XMLFilter


Member Data Documentation

JDOMFactory org::jdom::input::SAXBuilder::factory = null [protected]
 

The factory for creating new JDOM objects


The documentation for this class was generated from the following file:
Generated on Tue Jan 17 02:53:57 2006 for JDOM by  doxygen 1.4.6