org.newsml.toolkit.dom
Class XercesDOMFactory

java.lang.Object
  |
  +--org.newsml.toolkit.dom.XercesDOMFactory
All Implemented Interfaces:
DOMFactory, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XercesDOMFactory
extends Object
implements DOMFactory, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

Xerces implementation of DOMFactory.

Version:
2.0
Author:
Reuters PLC

Constructor Summary
XercesDOMFactory()
          Default constructor.
XercesDOMFactory(boolean validation)
          Constructor.
 
Method Summary
 org.w3c.dom.Document createDOM()
          Construct a new, empty DOM document.
 org.w3c.dom.Document createDOM(Reader reader, String baseURL)
          Construct a DOM package from the URL provided.
 org.w3c.dom.Document createDOM(String url)
          Construct a DOM package from the URL provided.
 void error(org.xml.sax.SAXParseException e)
          Catch validation errors.
 void fatalError(org.xml.sax.SAXParseException e)
          Catch fatal errors.
 boolean getValidation()
          Get the current validation state.
 org.xml.sax.InputSource resolveEntity(String publicId, String systemId)
          Entity resolver to ignore external entities (including DTD).
 void setValidation(boolean validation)
          Require or forbid DTD validation.
 void warning(org.xml.sax.SAXParseException e)
          Catch warnings.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XercesDOMFactory

public XercesDOMFactory()
Default constructor.

Construct a new, non-validating DOM factory.


XercesDOMFactory

public XercesDOMFactory(boolean validation)
Constructor.

Construct a new DOM factory with the requested validation type.

Parameters:
validation - true to require DTD validation, false to forbid it.
See Also:
DOMFactory.setValidation(boolean)
Method Detail

setValidation

public void setValidation(boolean validation)
Description copied from interface: DOMFactory
Require or forbid DTD validation.
Specified by:
setValidation in interface DOMFactory
See Also:
DOMFactory.setValidation(boolean)

getValidation

public boolean getValidation()
Description copied from interface: DOMFactory
Get the current validation state.
Specified by:
getValidation in interface DOMFactory
See Also:
DOMFactory.getValidation()

createDOM

public org.w3c.dom.Document createDOM()
Description copied from interface: DOMFactory
Construct a new, empty DOM document.
Specified by:
createDOM in interface DOMFactory
See Also:
DOMFactory.createDOM()

createDOM

public org.w3c.dom.Document createDOM(String url)
                               throws IOException
Description copied from interface: DOMFactory
Construct a DOM package from the URL provided.
Specified by:
createDOM in interface DOMFactory
See Also:
DOMFactory.createDOM(String)

createDOM

public org.w3c.dom.Document createDOM(Reader reader,
                                      String baseURL)
                               throws IOException
Description copied from interface: DOMFactory
Construct a DOM package from the URL provided.
Specified by:
createDOM in interface DOMFactory
See Also:
DOMFactory.createDOM(Reader,String)

resolveEntity

public org.xml.sax.InputSource resolveEntity(String publicId,
                                             String systemId)
                                      throws IOException
Entity resolver to ignore external entities (including DTD). This method is used by createDOM() so that the Xerces XML parser will not attempt to load the external DTD subset; it may not be necessary for other DOM libraries.
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Parameters:
publicId - The public identifier (ignored).
systemId - The system identifier (ignored).
Returns:
An InputSource containing an empty byte stream.

warning

public void warning(org.xml.sax.SAXParseException e)
Catch warnings.
Specified by:
warning in interface org.xml.sax.ErrorHandler
Parameters:
e - A SAXParseException describing the warning.

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXParseException
Catch validation errors.
Specified by:
error in interface org.xml.sax.ErrorHandler
Parameters:
e - A SAXParseException describing the validation error.
Throws:
Always - throws the exception on back.

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXParseException
Catch fatal errors.
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Parameters:
e - A SAXParseException describing the fatal error.
Throws:
Always - throws the exception on back.