All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface org.xmlmiddleware.xmlutils.ParserUtils

public interface ParserUtils
Interface for a class that generates implements parser-specific methods.

DOM and SAX do not cover all areas of functionality. This interface encapsulates bootstrapping (getting a DOMImplementation object and getting a SAX parser) and serializing a DOM Document to both a string and a file. Eventually, this should disappear through widespread implementation of JAXP and DOM level 3.

Version:
2.0
Author:
Adam Flinton, Ronald Bourret

Method Index

 o getDOMImplementation()
Get a DOMImplementation object.
 o getXMLReader(boolean)
Get a SAX 2.0 XMLReader.
 o openDocument(InputSource, boolean)
Open an InputSource and create a DOM Document.
 o writeDocument(Document)
Write a DOM Document to a String.
 o writeDocument(Document, String, String)
Write a DOM Document to a file.

Methods

 o getXMLReader
 public abstract XMLReader getXMLReader(boolean validating) throws XMLMiddlewareException
Get a SAX 2.0 XMLReader.

Parameters:
validating - Whether the XMLReader performs validation.
Returns:
An object that implements XMLReader.
Throws: XMLMiddlewareException
Thrown if an error occurs instantiating the XMLReader.
 o getDOMImplementation
 public abstract DOMImplementation getDOMImplementation() throws XMLMiddlewareException
Get a DOMImplementation object.

Returns:
The DOMImplementation object
Throws: XMLMiddlewareException
Thrown if an error occurs instantiating the DOMImplementation.
 o openDocument
 public abstract Document openDocument(InputSource src,
                                       boolean validate) throws XMLMiddlewareException
Open an InputSource and create a DOM Document.

Parameters:
src - A SAX InputSource
validate - Whether the InputSource is validated.
Returns:
An object that implements Document.
Throws: XMLMiddlewareException
Thrown if an error occurs creating the DOM Document.
 o writeDocument
 public abstract void writeDocument(Document doc,
                                    String xmlFilename,
                                    String encoding) throws XMLMiddlewareException
Write a DOM Document to a file.

Parameters:
doc - The DOM Document.
xmlFilename - The name of the XML file.
encoding - The output encoding to use. If this is null, the default encoding is used.
Throws: XMLMiddlewareException
Thrown if an error occurs writing the DOM Document.
 o writeDocument
 public abstract String writeDocument(Document doc) throws XMLMiddlewareException
Write a DOM Document to a String.

Parameters:
doc - The DOM Document.
Returns:
The XML string.
Throws: XMLMiddlewareException
Thrown if an error occurs writing the DOM Document.

All Packages  Class Hierarchy  This Package  Previous  Next  Index