com.xerceo.xml
Class Sax

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.xerceo.xml.Sax
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler
Direct Known Subclasses:
AbstractXmlFactory, CMIHandler, eSCORTE4JS, ExtensibleProfileFactory, IMSManifestHandler, LomAjaxSupport.LOMParameterHandler, LOMHandler, ManagedAppConfig, XModelMBeanInfo

public class Sax
extends org.xml.sax.helpers.DefaultHandler
implements org.xml.sax.ext.LexicalHandler

Much like its parent class, this is a base class for application specific SAX event handlers to extend. It helps minimize duplication of common SAX processing code. Also provides some class-level convenience methods for reading and writing XML.

Version:
#xerceo-1.0#
Author:
tim.potter@xerceo.com

Field Summary
protected  java.lang.StringBuffer buf
          Internal buffer that gets reused.
static java.lang.String CDATA
          Constant used by XML serializers for CDATA attribute types.
protected  java.lang.StringBuffer charsBuf
          Interal buffer used to save characters received from characters SAX events.
static java.lang.String DECL_HANDLER
          SAX property name for adding the DeclHandler to the XMLReader.
protected  java.lang.String dtdResourceName
          The resource name of the DTD on the classpath.
protected  java.lang.String dtdSystemId
          The external form of the URL to the DTD for the document this handler processes.
protected  java.util.Stack elementNameStack
          Keeps track of depth in the document.
static java.lang.String INDENT
          Constant for enabling indentation during output formatting.
static java.lang.String LEXICAL_SAX_PROPERTY
          SAX property name for adding a LexicalHandler to the XMLReader.
protected  java.lang.String namespace
          Holds the namespace URI for the XMLInteraction spec document.
static java.lang.String NMTOKEN
          Constant used by XML serializers for NMTOKEN attribute types.
static org.xml.sax.helpers.AttributesImpl NO_ATTRS
          Reference to an empty AttributesImpl instance for creating elements with no attributes.
protected  java.lang.String rootName
          Holds the root element name for the document.
static java.lang.String UTF_8_ENCODING
          Constant for the default XML character encoding: UTF-8.
protected  Version version
          Holds version information for a version element; only valid after handleVersionStart() method invoked.
 
Constructor Summary
Sax()
          Constructs a new Sax and ensures all member variables are initialized to prepare for handling SAX events.
Sax(java.lang.String dtdSystemId, java.lang.String dtdResourceName, java.lang.String namespace, java.lang.String rootName, boolean trackElementNames)
          Constructs a new Sax and ensures all member variables are initialized to prepare for handling SAX events.
 
Method Summary
static void applySAXExtensions(org.xml.sax.XMLReader xmlReader, org.xml.sax.ContentHandler handler)
          Applies the SAX extension handlers to the XMLReader if available.
 void characters(char[] ch, int start, int length)
          Read characters from ch into an internal buffer; if an element is interested in receiving character data, it will ensure the internal buffer is not null.
 void comment(char[] ch, int start, int length)
          No-op implementation required by the LexicalHandler interface.
 void endCDATA()
          No-op implementation required by the LexicalHandler interface.
 void endDocument()
          Resets the state of this instance back to its initialized state.
 void endDTD()
          No-op implementation required by the LexicalHandler interface.
protected  void endElement(java.lang.String localName)
          Convenience method for processing endElement events using the localName, as determined by the getElementName method.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 void endEntity(java.lang.String name)
          No-op implementation required by the LexicalHandler interface.
protected  void endUnknownElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Convenience method for processing endElement events where the appropriate element name is unknown as determined by a null return value form getElementName.
 void error(org.xml.sax.SAXParseException spe)
          Called by the SAX parser to indicate a non-fatal (recoverable) parse error, such as the violation of a validity constraint.
 void fatalError(org.xml.sax.SAXParseException spe)
          Called by the SAX parser to indicate a fatal parse error that prevents the SAX parser from processing the document, such as a violation of a well-formedness constraint.
static void fromXML(org.xml.sax.InputSource saxIn, boolean validate, org.xml.sax.helpers.DefaultHandler handler)
          Helper method for parsing an XML document using SAX.
protected  java.lang.String getChars()
           
protected  java.lang.String getElementName(java.lang.String ns, java.lang.String lName, java.lang.String qName)
          Determines the name of the element to process in the startElement(String, Attributes) method based on the namespace URI, local name, and qualified name provided by the SAX2 event generator.
protected  java.lang.String getElementPath()
          Returns a guess at the current element path where an error or warning occured.
protected  java.lang.Object[] getParamsFromSAXException(org.xml.sax.SAXParseException spe)
          Convenience method for extracting information from the SAXParseException into an array of replaceable parameters for generating a message.
static org.xml.sax.ContentHandler getSerializer(java.io.OutputStream out)
          Helper method for getting a SAX ContentHandler interface for serializing an object as XML.
static org.xml.sax.ContentHandler getSerializer(java.io.OutputStream out, java.util.Properties props)
          Helper method for getting a SAX ContentHandler interface for serializing an object as XML.
static org.xml.sax.ContentHandler getSerializer(javax.xml.transform.Result result, java.util.Properties props)
          Helper method for getting a SAX ContentHandler interface for serializing an object as XML.
static org.xml.sax.ContentHandler getToStringSerializer(java.io.StringWriter writer)
          Helper method for getting a SAX ContentHandler interface for serializing an object as XML to
static javax.xml.transform.Transformer getTransformer()
          Gets a TrAX Transformer instance with the default configuration.
static javax.xml.transform.TransformerFactory getTransformerFactory()
          Gets the TransformerFactory that this class uses to access any transformation resources it needs.
protected  void handleVersionEnd()
          Sets the version member variable back to null; sub-classes should over-ride this method to do something with the version object before setting it back to null.
protected  void handleVersionStart(org.xml.sax.Attributes attrs)
          Initializes the version member variable using the attributes from a version element found in the document.
protected  java.io.InputStream openSystemIdStream(java.lang.String systemId)
          Opens an I/O InputStream to the supplied systemId.
protected  java.io.InputStream openURLStream(java.lang.String systemId)
          Opens a network I/O InputStream to the supplied URL.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Provides a SAX InputSource to the DTD for validating the instance document.
 void startCDATA()
          No-op implementation required by the LexicalHandler interface.
 void startDocument()
          Sets all members used during a parse to null.
 void startDTD(java.lang.String name, java.lang.String pubId, java.lang.String sysId)
          No-op implementation required by the LexicalHandler interface.
protected  void startElement(java.lang.String localName, org.xml.sax.Attributes attrs)
          Convenience method for processing startElement events using the localName, as determined by the getElementName method.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
           
 void startEntity(java.lang.String name)
          No-op implementation required by the LexicalHandler interface.
protected  void startUnknownElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
          Convenience method for processing startElement events where the appropriate element name is unknown as determined by a null return value form getElementName.
static java.lang.String toAttrString(org.xml.sax.Attributes attrs)
           
static void toCDATA(char[] ach, org.xml.sax.ContentHandler sax)
           
static void toCDATA(java.lang.String cdata, org.xml.sax.ContentHandler sax)
           
static void toChars(java.lang.String cdata, org.xml.sax.ContentHandler sax)
           
static void toSimple(java.lang.String name, java.lang.String cdata, org.xml.sax.ContentHandler sax)
           
static void toSimple(java.lang.String nsUri, java.lang.String name, java.lang.String cdata, org.xml.sax.ContentHandler sax)
           
 void warning(org.xml.sax.SAXParseException spe)
          Called by the SAX parser to indicate a condition that is not an error or fatal error, but is still cause for concern.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEXICAL_SAX_PROPERTY

public static final java.lang.String LEXICAL_SAX_PROPERTY
SAX property name for adding a LexicalHandler to the XMLReader.

See Also:
Constant Field Values

DECL_HANDLER

public static final java.lang.String DECL_HANDLER
SAX property name for adding the DeclHandler to the XMLReader.

See Also:
Constant Field Values

CDATA

public static final java.lang.String CDATA
Constant used by XML serializers for CDATA attribute types.

See Also:
Constant Field Values

NMTOKEN

public static final java.lang.String NMTOKEN
Constant used by XML serializers for NMTOKEN attribute types.

See Also:
Constant Field Values

UTF_8_ENCODING

public static final java.lang.String UTF_8_ENCODING
Constant for the default XML character encoding: UTF-8.

See Also:
Constant Field Values

INDENT

public static final java.lang.String INDENT
Constant for enabling indentation during output formatting.

See Also:
Constant Field Values

NO_ATTRS

public static final org.xml.sax.helpers.AttributesImpl NO_ATTRS
Reference to an empty AttributesImpl instance for creating elements with no attributes.


dtdSystemId

protected java.lang.String dtdSystemId
The external form of the URL to the DTD for the document this handler processes. The entity resolution algorithm employed by this implementation will attempt to locate the DTD on the CLASSPATH before going to the net to retrieve it.


dtdResourceName

protected java.lang.String dtdResourceName
The resource name of the DTD on the classpath.


namespace

protected java.lang.String namespace
Holds the namespace URI for the XMLInteraction spec document.


rootName

protected java.lang.String rootName
Holds the root element name for the document.


charsBuf

protected java.lang.StringBuffer charsBuf
Interal buffer used to save characters received from characters SAX events. If an element is interested in retrieving character content, it should make sure that it sets this member to buf in the startElement method.


buf

protected java.lang.StringBuffer buf
Internal buffer that gets reused. Consequently, it is important to call buf.setLength(0); after retrieving content from it with a call to buf.toString();


elementNameStack

protected java.util.Stack elementNameStack
Keeps track of depth in the document.


version

protected Version version
Holds version information for a version element; only valid after handleVersionStart() method invoked.

Constructor Detail

Sax

public Sax()
Constructs a new Sax and ensures all member variables are initialized to prepare for handling SAX events.


Sax

public Sax(java.lang.String dtdSystemId,
           java.lang.String dtdResourceName,
           java.lang.String namespace,
           java.lang.String rootName,
           boolean trackElementNames)
Constructs a new Sax and ensures all member variables are initialized to prepare for handling SAX events.

Parameters:
dtdSystemId - The external form of the URL for the DTD; may be null of the document doesn't have a DTD.
dtdResourceName - The CLASSPATH resource path for the DTD if it is available on the CLASSPATH; to avoid a call to the Internet.
namespace - The default namespace URI used by the source document.
rootName - The root name (local) of the document.
trackElementNames - A flag to indicate if element name tracking (using a standard Stack) is desired by the application.
Method Detail

toCDATA

public static final void toCDATA(char[] ach,
                                 org.xml.sax.ContentHandler sax)
                          throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

toCDATA

public static final void toCDATA(java.lang.String cdata,
                                 org.xml.sax.ContentHandler sax)
                          throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

toChars

public static final void toChars(java.lang.String cdata,
                                 org.xml.sax.ContentHandler sax)
                          throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

toSimple

public static final void toSimple(java.lang.String name,
                                  java.lang.String cdata,
                                  org.xml.sax.ContentHandler sax)
                           throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

toSimple

public static final void toSimple(java.lang.String nsUri,
                                  java.lang.String name,
                                  java.lang.String cdata,
                                  org.xml.sax.ContentHandler sax)
                           throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getTransformerFactory

public static javax.xml.transform.TransformerFactory getTransformerFactory()
Gets the TransformerFactory that this class uses to access any transformation resources it needs.

Returns:
A TrAX TransformerFactory instance.

getTransformer

public static javax.xml.transform.Transformer getTransformer()
                                                      throws javax.xml.transform.TransformerConfigurationException
Gets a TrAX Transformer instance with the default configuration.

Returns:
A TrAX Transformer instance.
Throws:
javax.xml.transform.TransformerConfigurationException

getToStringSerializer

public static org.xml.sax.ContentHandler getToStringSerializer(java.io.StringWriter writer)
                                                        throws org.xml.sax.SAXException
Helper method for getting a SAX ContentHandler interface for serializing an object as XML to

Parameters:
out - The destination for the XML output.
Returns:
A SAX2 ContentHandler.
Throws:
org.xml.sax.SAXException - if an error occurs while creating the serializer.

getSerializer

public static org.xml.sax.ContentHandler getSerializer(java.io.OutputStream out)
                                                throws org.xml.sax.SAXException
Helper method for getting a SAX ContentHandler interface for serializing an object as XML.

Parameters:
out - The destination for the XML output.
Returns:
A SAX2 ContentHandler.
Throws:
org.xml.sax.SAXException - if an error occurs while creating the serializer.

getSerializer

public static org.xml.sax.ContentHandler getSerializer(java.io.OutputStream out,
                                                       java.util.Properties props)
                                                throws org.xml.sax.SAXException
Helper method for getting a SAX ContentHandler interface for serializing an object as XML.

Parameters:
out - The destination for the XML output.
props - The output formatting properties.
Returns:
A SAX2 ContentHandler.
Throws:
org.xml.sax.SAXException - if an error occurs while creating the serializer.

getSerializer

public static org.xml.sax.ContentHandler getSerializer(javax.xml.transform.Result result,
                                                       java.util.Properties props)
                                                throws org.xml.sax.SAXException
Helper method for getting a SAX ContentHandler interface for serializing an object as XML.

Parameters:
result - The destination for the XML output.
props - The output formatting properties.
Returns:
A SAX2 ContentHandler.
Throws:
org.xml.sax.SAXException - if an error occurs while creating the serializer.

fromXML

public static void fromXML(org.xml.sax.InputSource saxIn,
                           boolean validate,
                           org.xml.sax.helpers.DefaultHandler handler)
                    throws org.xml.sax.SAXException
Helper method for parsing an XML document using SAX.

Parameters:
saxIn - The SAX InputSource to the XML document.
validate - A boolean flag that governs whether the parser validates the document against its DTD or schema.
handler - The SAX ContentHandler to send SAX2 events to.
Throws:
org.xml.sax.SAXException - if the document is not well-formed.

applySAXExtensions

public static void applySAXExtensions(org.xml.sax.XMLReader xmlReader,
                                      org.xml.sax.ContentHandler handler)
Applies the SAX extension handlers to the XMLReader if available.

Parameters:
xmlReader - The XMLReader to apply the extensions to.
handler - The object that possibly implements the SAX extension interfaces.

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Sets all members used during a parse to null.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - if an error occurs while initializing.

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Resets the state of this instance back to its initialized state.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - if an error occurs while resetting.

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

toAttrString

public static java.lang.String toAttrString(org.xml.sax.Attributes attrs)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

getElementName

protected final java.lang.String getElementName(java.lang.String ns,
                                                java.lang.String lName,
                                                java.lang.String qName)
Determines the name of the element to process in the startElement(String, Attributes) method based on the namespace URI, local name, and qualified name provided by the SAX2 event generator.

Parameters:
ns - The namespace URI.
lName - The local element name.
qName - The qualified element name.
Returns:
String The appropriate element name.

startElement

protected void startElement(java.lang.String localName,
                            org.xml.sax.Attributes attrs)
                     throws org.xml.sax.SAXException
Convenience method for processing startElement events using the localName, as determined by the getElementName method.

Parameters:
localName - The local element name, as determined by the getElementName method.
attrs - The element attributes.
Throws:
org.xml.sax.SAXException - if the element processing encounters an error.
See Also:
getElementName(java.lang.String, java.lang.String, java.lang.String)

startUnknownElement

protected void startUnknownElement(java.lang.String namespaceURI,
                                   java.lang.String localName,
                                   java.lang.String qName,
                                   org.xml.sax.Attributes attrs)
                            throws org.xml.sax.SAXException
Convenience method for processing startElement events where the appropriate element name is unknown as determined by a null return value form getElementName.

Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local element name, as determined by the getElementName method.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
attrs - The element attributes.
Throws:
org.xml.sax.SAXException - if the element processing encounters an error.
See Also:
getElementName(java.lang.String, java.lang.String, java.lang.String)

endElement

protected void endElement(java.lang.String localName)
                   throws org.xml.sax.SAXException
Convenience method for processing endElement events using the localName, as determined by the getElementName method.

Parameters:
localName - The local element name, as determined by the getElementName method.
Throws:
org.xml.sax.SAXException - if the element processing encounters an error.
See Also:
getElementName(java.lang.String, java.lang.String, java.lang.String)

endUnknownElement

protected void endUnknownElement(java.lang.String namespaceURI,
                                 java.lang.String localName,
                                 java.lang.String qName)
                          throws org.xml.sax.SAXException
Convenience method for processing endElement events where the appropriate element name is unknown as determined by a null return value form getElementName.

Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local element name, as determined by the getElementName method.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
org.xml.sax.SAXException - if the element processing encounters an error.
See Also:
getElementName(java.lang.String, java.lang.String, java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
Read characters from ch into an internal buffer; if an element is interested in receiving character data, it will ensure the internal buffer is not null. This implies that the endElement() implementation needs to be sure to reset the charsBuf member back to null after reading its contents.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - An array of characters that are currently available to be read from the XML stream; should be appended to an internal buffer.
start - The index from which to start reading characters from ch.
length - The number of characters to extract from ch.

comment

public void comment(char[] ch,
                    int start,
                    int length)
No-op implementation required by the LexicalHandler interface. Override if you need to process comments.

Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
Parameters:
ch - An array of characters that are currently available to be read from the XML stream.
start - The index from which to start reading characters from ch.
length - The number of characters to extract from ch.

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String pubId,
                     java.lang.String sysId)
No-op implementation required by the LexicalHandler interface. Override if you need to process the start of DTD declarations, if there are any available.

Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
Parameters:
name - The document type name.
pubId - The public ID of the document type.
sysId - The system ID of the document type.

endDTD

public void endDTD()
No-op implementation required by the LexicalHandler interface. Override if you need to process the end of DTD declarations, if there are any available.

Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler

startEntity

public void startEntity(java.lang.String name)
No-op implementation required by the LexicalHandler interface. Override if you need to process the beginning of some internal and external XML entities.

Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
Parameters:
name - The entity name.

endEntity

public void endEntity(java.lang.String name)
No-op implementation required by the LexicalHandler interface. Override if you need to process the end of some internal and external XML entities.

Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
Parameters:
name - The entity name.

startCDATA

public void startCDATA()
No-op implementation required by the LexicalHandler interface. Override if you need to process the beginning of a CDATA section. Note, that you probably do not need to override this because you will still receive the internal characters of the CDATA section in the characters method with this no-op implementation.

Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler

endCDATA

public void endCDATA()
No-op implementation required by the LexicalHandler interface. Override if you need to process the end of a CDATA section.

Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler

error

public void error(org.xml.sax.SAXParseException spe)
           throws org.xml.sax.SAXException
Called by the SAX parser to indicate a non-fatal (recoverable) parse error, such as the violation of a validity constraint. This implementation logs and re-throws the exception to indicate that it cannot proceed with processing if a violation of a validity constraint is encountered.

Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - The error information encapsulated in a SAXParseException
Throws:
org.xml.sax.SAXException - Any SAX exception, possible wrapping another exception.

fatalError

public void fatalError(org.xml.sax.SAXParseException spe)
                throws org.xml.sax.SAXException
Called by the SAX parser to indicate a fatal parse error that prevents the SAX parser from processing the document, such as a violation of a well-formedness constraint. This implementation logs and re-throws the exception to indicate that it cannot proceed with processing.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - The error information encapsulated in a SAXParseException
Throws:
org.xml.sax.SAXException - Any SAX exception, possible wrapping another exception.

warning

public void warning(org.xml.sax.SAXParseException spe)
Called by the SAX parser to indicate a condition that is not an error or fatal error, but is still cause for concern. This implementation logs the warning, but does not re-throw the exception. Processing should proceed.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - The warning information encapsulated in a SAXParseException

getParamsFromSAXException

protected java.lang.Object[] getParamsFromSAXException(org.xml.sax.SAXParseException spe)
Convenience method for extracting information from the SAXParseException into an array of replaceable parameters for generating a message.

Parameters:
spe - The error information encapsulated in a SAXParseException
Returns:
Object[] An array of information about the error.

getElementPath

protected java.lang.String getElementPath()
Returns a guess at the current element path where an error or warning occured. This method can only return a valid path if the subclass utilizes the elementNameStack in its processing.

Returns:
String a best guess at the current element path where an error or warning occurred.

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
Provides a SAX InputSource to the DTD for validating the instance document. The systemId is used to locate the DTD. This method supports two approaches to reading the DTD: 1) a well-formed URL with a supported protocol handler, such as HTTP or file; or 2) "http://www.xerceo.com/dtd/xmmb_1_0.dtd", which is a resource path accessible to this class' ClassLoader.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
Parameters:
publicId - A well-known directory; not used by this implementation.
systemId - A URL to the external entity.
Returns:
a SAX InputSource if the entity can be accessed by the supplied systemId; null otherwise. This method logs any exceptions or error conditions and does not generate an exception in the event that the entity is not accessible.

openSystemIdStream

protected java.io.InputStream openSystemIdStream(java.lang.String systemId)
Opens an I/O InputStream to the supplied systemId.

Parameters:
systemId - A URL to the entity.
Returns:
InputStream A stream for reading the entity; null if not available.

openURLStream

protected java.io.InputStream openURLStream(java.lang.String systemId)
Opens a network I/O InputStream to the supplied URL.

Parameters:
systemId - A URL to the entity.
Returns:
InputStream A stream for reading the entity; null if not available.

handleVersionStart

protected void handleVersionStart(org.xml.sax.Attributes attrs)
                           throws org.xml.sax.SAXException
Initializes the version member variable using the attributes from a version element found in the document.

Parameters:
attrs - The SAX attributes container.
Throws:
org.xml.sax.SAXException - if an error occurs while trying to read the attributes and initialize a version object.

handleVersionEnd

protected void handleVersionEnd()
                         throws org.xml.sax.SAXException
Sets the version member variable back to null; sub-classes should over-ride this method to do something with the version object before setting it back to null.

Throws:
org.xml.sax.SAXException - if an error occurs.

getChars

protected java.lang.String getChars()


Copyright © 2006. Xerceo, Inc. All Rights Reserved.