All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.xmlmiddleware.xmlutils.external.ParserUtilsXerces

java.lang.Object
   |
   +----org.xmlmiddleware.xmlutils.external.ParserUtilsXerces

public class ParserUtilsXerces
extends Object
implements ParserUtils
Implements ParserUtils for the Xerces parser.

Supports any(?) version of Xerces that supports JAXP.

Version:
2.0
Author:
Adam Flinton, Paul Gubbay

Constructor Index

 o ParserUtilsXerces()
Construct a ParserUtilsXerces object.

Method Index

 o getDOMImplementation()
Get a DOMImplementation object.
 o getXMLReader(boolean)
Return an object that wraps an 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.

Constructors

 o ParserUtilsXerces
 public ParserUtilsXerces()
Construct a ParserUtilsXerces object.

Methods

 o getXMLReader
 public XMLReader getXMLReader(boolean validating) throws XMLMiddlewareException
Return an object that wraps an XMLReader. The XMLReader is wrapped within the SAXParser.

Parameters:
validating - Whether the XMLReader performs validation.
Returns:
XMLReader wrapped within a SAXParser
Throws: XMLMiddlewareException
thrown when the SAXParserFactory encounters a problem creating a new SAXParser
 o getDOMImplementation
 public 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 Document openDocument(InputSource src,
                              boolean validate) throws XMLMiddlewareException
Open an InputSource and create a DOM Document

Parameters:
src - SAX InputSource to be parsed into a Document
validate - Whether the InputSource is validated.
Returns:
Document containing a DOM representation of InputSource
Throws: XMLMiddlewareException
Thrown if there is a problem parsing the InputSource
 o writeDocument
 public 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 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