org.jdom.input
Class SAXBuilder

java.lang.Object
  |
  +--org.jdom.input.SAXBuilder

public class SAXBuilder
extends java.lang.Object

SAXBuilder builds a JDOM tree using SAX.

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

Constructor Summary
SAXBuilder()
           This creates a SAXBuilder with the default SAX driver and no validation.
SAXBuilder(boolean validate)
           This sets validation for the Builder.
SAXBuilder(java.lang.String saxDriverClass)
           This sets the SAX Driver class to use, and leaves validation off.
SAXBuilder(java.lang.String saxDriverClass, boolean validate)
           This allows the validation features to be turned on/off in the builder at creation, as well as set the DOM Adapter class to use.
 
Method Summary
 Document build(java.io.File file)
           This builds a document from the supplied filename.
protected  Document build(org.xml.sax.InputSource in)
           This builds a document from the supplied input source.
 Document build(java.io.InputStream in)
           This builds a document from the supplied input stream.
 Document build(java.io.InputStream in, java.lang.String systemId)
           This builds a document from the supplied input stream.
 Document build(java.io.Reader characterStream)
           This builds a document from the supplied Reader.
 Document build(java.io.Reader characterStream, java.lang.String SystemId)
           This builds a document from the supplied Reader.
 Document build(java.lang.String systemId)
           This builds a document from the supplied URI.
 Document build(java.net.URL url)
           This builds a document from the supplied URL.
protected  java.net.URL fileToURL(java.io.File f)
          Imitation of File.toURL(), a JDK 1.2 method, reimplemented here to work with JDK 1.1.
 void setDTDHandler(org.xml.sax.DTDHandler dtdHandler)
           This sets custom DTDHandler for the Builder.
 void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
           This sets custom EntityResolver for the Builder.
 void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
           This sets custom ErrorHandler for the Builder.
 void setValidation(boolean validate)
           This sets validation for the Builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXBuilder

public SAXBuilder(java.lang.String saxDriverClass,
                  boolean validate)

This allows the validation features to be turned on/off in the builder at creation, as well as set the DOM Adapter class to use.

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

SAXBuilder

public SAXBuilder(java.lang.String saxDriverClass)

This sets the SAX Driver class to use, and leaves validation off.

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

SAXBuilder

public SAXBuilder(boolean validate)

This sets validation for the Builder.

Parameters:
validate - boolean indicating if validation should occur.

SAXBuilder

public SAXBuilder()

This creates a SAXBuilder with the default SAX driver and no validation.

Method Detail

setValidation

public void setValidation(boolean validate)

This sets validation for the Builder.

Parameters:
errorHandler - boolean indicating whether validation should occur.

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)

This sets custom ErrorHandler for the Builder.

Parameters:
errorHandler - ErrorHandler

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)

This sets custom EntityResolver for the Builder.

Parameters:
entityResolver - EntityResolver

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler dtdHandler)

This sets custom DTDHandler for the Builder.

Parameters:
dtdHandler - DTDHandler

build

protected Document build(org.xml.sax.InputSource in)
                  throws JDOMException

This builds a document from the supplied input source.

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

build

public Document build(java.io.InputStream in)
               throws 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(java.io.File file)
               throws 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(java.net.URL url)
               throws 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(java.io.InputStream in,
                      java.lang.String systemId)
               throws 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(java.io.Reader characterStream)
               throws 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(java.io.Reader characterStream,
                      java.lang.String SystemId)
               throws 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(java.lang.String systemId)
               throws 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.

fileToURL

protected java.net.URL fileToURL(java.io.File f)
                          throws java.net.MalformedURLException
Imitation of File.toURL(), a JDK 1.2 method, reimplemented here to work with JDK 1.1.
Parameters:
f - the file to convert
Returns:
the file path converted to a file: URL
See Also:
File


Copyright © 2000 Brett McLaughlin, Jason Hunter. All Rights Reserved.