|
XML for Java Compatibility API 2.0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.xml.parser.SAXDriver
This is the Simple API for XML (SAX) 1.0 driver for IBM XML4J. It implements the Parser and AttributeInterfaces as defined by SAX, and the ErrorListener, TagHandler, and StreamProducer interfaces defined by XML4J.
The Parser interface allows applications to register handlers for different types of events and to initiate a parse from a URI, or a character stream.
The AttributeList interface enables XML4J to pass an instance to the SAX application as the second argument of each startElement event. The instance provided will return valid results only during the scope of the startElement invocation.
Parser
,
AttributeList
,
TXDocument
Constructor Summary | |
SAXDriver()
|
Method Summary | |
void |
closeInputStream(Source source)
This method is for XML4J-internal use and should not be called by SAX applications. |
int |
error(java.lang.String fileName,
int lineNo,
int charOffset,
java.lang.Object key,
java.lang.String msg)
This method is for XML4J-internal use and should not be called by SAX applications. |
Source |
getInputStream(java.lang.String name,
java.lang.String publicID,
java.lang.String systemID)
This method is for XML4J-internal use and should not be called by SAX applications. |
int |
getLength()
Return the number of attributes in this list. |
java.lang.String |
getName(int i)
Return the name of an attribute in this list according to the specified index i. |
java.lang.String |
getType(int i)
Return the type of an attribute in the list according to the specified index i. |
java.lang.String |
getType(java.lang.String name)
Return the type of an attribute in the list according to the specified name. |
java.lang.String |
getValue(int i)
Return the value of an attribute in the list according to the specified index i. |
java.lang.String |
getValue(java.lang.String name)
Return the value of an attribute in the list according to the specified name. |
void |
handleEndTag(TXElement el,
boolean empty)
This method is for XML4J-internal use and should not be called by SAX applications. |
void |
handleStartTag(TXElement element,
boolean empty)
This method is for XML4J-internal use and should not be called by SAX applications. |
void |
loadCatalog(java.io.Reader reader)
This method is for XML4J-internal use and should not be called by SAX applications. |
void |
parse(org.xml.sax.InputSource isrc)
Begin parsing an XML document from any valid input source (a character stream or a byte stream). |
void |
parse(java.lang.String systemId)
Begin parsing an XML document from a system identifier (URI). |
void |
setDocumentHandler(org.xml.sax.DocumentHandler handler)
Register a document event handler. |
void |
setDTDHandler(org.xml.sax.DTDHandler handler)
Register a DTD event handler. |
void |
setEntityResolver(org.xml.sax.EntityResolver handler)
Register a custom entity resolver. |
void |
setErrorHandler(org.xml.sax.ErrorHandler handler)
Register an error event handler. |
void |
setLocale(java.util.Locale locale)
Sets a locale for errors and warnings. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SAXDriver()
Method Detail |
public void setLocale(java.util.Locale locale) throws org.xml.sax.SAXException
This method is defined by SAX.
locale
- A Java Locale object.SAXException
,
SAXParseException
public void setEntityResolver(org.xml.sax.EntityResolver handler)
This method is defined by SAX.
handler
- The entity hander.EntityResolver
,
HandlerBase
public void setDTDHandler(org.xml.sax.DTDHandler handler)
This method is defined by SAX.
handler
- The DTD handler.DTDHandler
,
HandlerBase
public void setDocumentHandler(org.xml.sax.DocumentHandler handler)
This method is defined by SAX.
handler
- The document handler.DocumentHandler
,
HandlerBase
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
This method is defined by SAX.
handler
- The error handler.ErrorHandler
,
SAXException
,
HandlerBase
public void parse(org.xml.sax.InputSource isrc) throws org.xml.sax.SAXException
This method is defined by SAX.
source
- The input source for the top-level of the XML document.InputSource
,
parse(java.lang.String)
,
setEntityResolver(org.xml.sax.EntityResolver)
,
setDTDHandler(org.xml.sax.DTDHandler)
,
setDocumentHandler(org.xml.sax.DocumentHandler)
,
setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(java.lang.String systemId) throws org.xml.sax.SAXException
parse(new InputSource(systemId));
If the system identifier is a URL, it must be fully resolved by the application before it is passed to XML4J.
This method is defined by SAX.
systemId
- The system identifier (URI).parse(org.xml.sax.InputSource)
public int getLength()
This method is defined by SAX.
public java.lang.String getName(int i)
This method is defined by SAX.
i
- The index of the attribute in the list (starting at 0).getLength()
public java.lang.String getType(int i)
The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case). If the parser has not read a declaration for the attribute, the value "CDATA" is returned. For an enumerated attribute that is not a notation, the parser will report the type as "NMTOKEN".
This method is defined by SAX.
i
- The index of the attribute in the list (starting at 0).getLength()
,
getType(java.lang.String)
public java.lang.String getType(java.lang.String name)
This method is defined by SAX.
name
- The name of the attribute.getType(int)
public java.lang.String getValue(int i)
This method is defined by SAX.
i
- The index of the attribute in the list (starting at 0).getLength()
,
getValue(java.lang.String)
public java.lang.String getValue(java.lang.String name)
This method is defined by SAX.
i
- The index of the attribute in the list.getValue(int)
public Source getInputStream(java.lang.String name, java.lang.String publicID, java.lang.String systemID) throws java.io.IOException, java.lang.RuntimeException
Returns the source of the input stream (could be a character stream or a byte stream) based on the entity specified by the system ID and/or public ID. Any registered entity handler will be invoked to resolve the entity specified by the system and public IDs.
This method is defined by StreamProducer.
name
- CURRENTLY NOT IMPLEMENTED.publicID
- Entity's public ID, or null if no public ID (see ExternalID for details).systemID
- Entity's system ID.entityHandler
is unable to resolve the entity from the specified IDs.ExternalID
,
closeInputStream(com.ibm.xml.parser.Source)
public void closeInputStream(Source source)
Removes the input stream currently in use.
This method is defined by StreamProducer.
source
- CURRENTLY NOT IMPLEMENTED.getInputStream(java.lang.String, java.lang.String, java.lang.String)
public void loadCatalog(java.io.Reader reader) throws java.io.IOException
This method is defined by StreamProducer.
public int error(java.lang.String fileName, int lineNo, int charOffset, java.lang.Object key, java.lang.String msg) throws java.lang.RuntimeException
Listen for XML4J parser errors, and reports these errors through any registered SAX error handler.
fileName
- Processing file name, or null if error or warning
occurs in a document.lineNo
- The line number where the current document event ends, or
-1 if not available. Note that this is the line
position of the first character after the text associated with
the document event. Do NOT trust this value when the input
stream includes invalid octet as its encoding.charOffset
- The column number where the current document event ends, or
-1 if not available. Note that this is the column
number of the first character after the text associated with the
document event. The first column in a line is position 1. Do NOT
trust this value when the input stream includes invalid octet as its encoding.key
- The object may be an instance of String
or Exception
.
When this object is String
, this value may help
classify msg as an error (begins with "E_") or warning
(begins with "W_").msg
- The error or warning message.
This method is defined by ErrorListener.
errorHandler
fails.setErrorHandler(org.xml.sax.ErrorHandler)
public void handleStartTag(TXElement element, boolean empty) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that a start tag (and any attributes) has been parsed. This method will notify any registered document handlers.
This method is defined by TagHandler.
element
- TXElement that was parsed.empty
- Not used by this method.documentHandler
fails.setDocumentHandler(org.xml.sax.DocumentHandler)
,
handleEndTag(com.ibm.xml.parser.TXElement, boolean)
public void handleEndTag(TXElement el, boolean empty) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that an end tag has been parsed. This method will notify any registered document handlers.
This method is defined by TagHandler.
el
- TXElement that was parsed.empty
- Not used by this method.documentHandler
fails.setDocumentHandler(org.xml.sax.DocumentHandler)
,
handleStartTag(com.ibm.xml.parser.TXElement, boolean)
|
XML for Java Compatibility API 2.0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |