org.jdom.input
Class SAXBuilder


public class SAXBuilder

SAXBuilder builds a JDOM tree using SAX.

Author:
Brett McLaughlin, Jason Hunter, Dan Schaffer
Version: 1.0

Constructor Summary
SAXBuilder()
           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.
SAXBuilder(boolean validate)
           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.
SAXBuilder(String saxDriverClass)
           Creates a new SAXBuilder using the specified SAX parser.
SAXBuilder(String saxDriverClass, boolean validate)
           Creates a new SAXBuilder using the specified SAX parser.

Method Summary
 Documentbuild(InputStream in)
           This builds a document from the supplied input stream.
 Documentbuild(File file)
           This builds a document from the supplied filename.
 Documentbuild(URL url)
           This builds a document from the supplied URL.
 Documentbuild(InputStream in, String systemId)
           This builds a document from the supplied input stream.
 Documentbuild(Reader characterStream)
           This builds a document from the supplied Reader.
 Documentbuild(Reader characterStream, String SystemId)
           This builds a document from the supplied Reader.
 Documentbuild(String systemId)
           This builds a document from the supplied URI.
 voidsetDTDHandler(DTDHandler dtdHandler)
           This sets custom DTDHandler for the Builder.
 voidsetEntityResolver(EntityResolver entityResolver)
           This sets custom EntityResolver for the Builder.
 voidsetErrorHandler(ErrorHandler errorHandler)
           This sets custom ErrorHandler for the Builder.
 voidsetValidation(boolean validate)
           This sets validation for the builder.
 voidsetXMLFilter(XMLFilter xmlFilter)
           This sets custom XMLFilter for the Builder.

Constructor Detail

SAXBuilder

public SAXBuilder()

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.


SAXBuilder

public SAXBuilder(boolean validate)

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.

SAXBuilder

public SAXBuilder(String saxDriverClass)

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.

SAXBuilder

public SAXBuilder(String saxDriverClass, boolean validate)

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.
Method Detail

build

public Document build(InputStream in)
throws org.jdom.JDOMException

This builds a document from the supplied input stream.

Parameters:
in - InputStream to read from.
Returns: Document - resultant Document object.
Throws:
JDOMException - when errors occur in parsing.

build

public Document build(File file)
throws org.jdom.JDOMException

This builds a document from the supplied filename.

Parameters:
file - File to read from.
Returns: Document - resultant Document object.
Throws:
JDOMException - when errors occur in parsing.

build

public Document build(URL url)
throws org.jdom.JDOMException

This builds a document from the supplied URL.

Parameters:
url - URL to read from.
Returns: Document - resultant Document object.
Throws:
JDOMException - when errors occur in parsing.

build

public Document build(InputStream in, String systemId)
throws org.jdom.JDOMException

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.
Throws:
JDOMException - when errors occur in parsing.

build

public Document build(Reader characterStream)
throws org.jdom.JDOMException

This builds a document from the supplied Reader.

Parameters:
in - Reader to read from.
Returns: Document - resultant Document object.
Throws:
JDOMException - when errors occur in parsing.

build

public Document build(Reader characterStream, String SystemId)
throws org.jdom.JDOMException

This builds a document from the supplied Reader.

Parameters:
in - Reader to read from.
systemId - base for resolving relative URIs
Returns: Document - resultant Document object.
Throws:
JDOMException - when errors occur in parsing.

build

public Document build(String systemId)
throws org.jdom.JDOMException

This builds a document from the supplied URI.

Parameters:
systemId - URI for the input
Returns: Document - resultant Document object.
Throws:
JDOMException - when errors occur in parsing.

setDTDHandler

public void setDTDHandler(DTDHandler dtdHandler)

This sets custom DTDHandler for the Builder.

Parameters:
dtdHandler - DTDHandler

setEntityResolver

public void setEntityResolver(EntityResolver entityResolver)

This sets custom EntityResolver for the Builder.

Parameters:
entityResolver - EntityResolver

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)

This sets custom ErrorHandler for the Builder.

Parameters:
errorHandler - ErrorHandler

setValidation

public void setValidation(boolean validate)

This sets validation for the builder.

Parameters:
validate - boolean indicating whether validation should occur.

setXMLFilter

public void setXMLFilter(XMLFilter xmlFilter)

This sets custom XMLFilter for the Builder.

Parameters:
xmlFilter - XMLFilter

Association Links

to Class java.lang.String

Default parser class to use. This is used when no other parser is given and JAXP isn't available.

to Class java.lang.String

Adapter class to use