Contents | Package | Class | Tree | Deprecated | Index | Help | XML for Java 1.0.4 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----com.ibm.xml.parser.DefaultElementFactory | +----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.
Constructor Summary | |
SAXDriver()
|
Method Summary | |
void | closeInputStream(Source source)
|
TXCDATASection | createCDATA(java.lang.String data)
|
DTD | createDTD(java.lang.String rootElementName,
ExternalID externalID)
|
Entity | createEntity(java.lang.String name,
ExternalID externalID,
boolean isParameter,
java.lang.String ndata)
|
NamespacePI | createNamespacePI(java.lang.String name,
java.lang.String data,
java.lang.String nsURI,
java.lang.String prefixName,
java.lang.String srcURI)
|
TXNotation | createNotation(java.lang.String name,
ExternalID externalID)
|
TXPI | createPI(java.lang.String name,
java.lang.String data)
|
StylesheetPI | createStylesheetPI(java.lang.String name,
java.lang.String data,
java.lang.String type,
java.lang.String hrefURI,
java.lang.String title)
|
TXText | createText(char[] carray,
int offset,
int length,
boolean ignorableWhitespace)
|
void | error(java.lang.String fileName,
int lineNo,
int charOffset,
java.lang.Object key,
java.lang.String msg)
|
Source | getInputStream(java.lang.String name,
java.lang.String publicID,
java.lang.String systemID)
|
int | getLength()
|
java.lang.String | getName(int i)
|
java.lang.String | getType(int i)
|
java.lang.String | getType(java.lang.String name)
|
java.lang.String | getValue(int i)
|
java.lang.String | getValue(java.lang.String name)
|
void | handleEndTag(TXElement el,
boolean empty)
|
void | handleStartTag(TXElement element,
boolean empty)
|
void | loadCatalog(java.io.Reader reader)
|
void | parse(InputSource isrc)
|
void | parse(java.lang.String systemId)
|
void | setDocumentHandler(DocumentHandler handler)
|
void | setDTDHandler(DTDHandler handler)
|
void | setEntityResolver(EntityResolver handler)
|
void | setErrorHandler(ErrorHandler handler)
|
void | setLocale(java.util.Locale locale)
|
Methods inherited from class com.ibm.xml.parser.DefaultElementFactory |
createAttDef, createAttlist, createAttribute, createAttributeList, createCDATA, createComment, createContentModel, createContentModel, createDocument, createDTD, createDTD, createElement, createElementDecl, createEntity, createEntity, createGeneralReference, createMessageDigest, createNamespacePI, createNotation, createPI, createStylesheetPI, createText, createText, createText, getInstance, setDigestAlgorithm |
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 SAXException
This method is defined by SAX.
locale
- A Java Locale object.
public void setEntityResolver(EntityResolver handler)
This method is defined by SAX.
handler
- The entity hander.
public void setDTDHandler(DTDHandler handler)
This method is defined by SAX.
handler
- The DTD handler.
public void setDocumentHandler(DocumentHandler handler)
This method is defined by SAX.
handler
- The document handler.
public void setErrorHandler(ErrorHandler handler)
This method is defined by SAX.
handler
- The error handler.
public void parse(InputSource isrc) throws SAXException
This method is defined by SAX.
source
- The input source for the top-level of the XML document.
public void parse(java.lang.String systemId) throws 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).
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).
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).
public java.lang.String getType(java.lang.String name)
This method is defined by SAX.
name
- The name of the attribute.
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).
public java.lang.String getValue(java.lang.String name)
This method is defined by SAX.
i
- The index of the attribute in the list.
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.public void closeInputStream(Source source)
Removes the input stream currently in use.
This method is defined by StreamProducer.
source
- CURRENTLY NOT IMPLEMENTED.
public void loadCatalog(java.io.Reader reader) throws java.io.IOException
This method is defined by StreamProducer.
public void 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.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.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.public DTD createDTD(java.lang.String rootElementName, ExternalID externalID)
Called by the XML4J parser in order to signal that a DTD has been parsed.
This method is defined by ElementFactory.
rootElementName
- Name of the root Element to associate with the DTD.
externalID
- The external ID associated with the DTD, or null if
the DTD does not have an external ID.
public Entity createEntity(java.lang.String name, ExternalID externalID, boolean isParameter, java.lang.String ndata) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that an entity has been parsed. This method will notify any registered DTD handlers if an external binary entity is recognized.
This method is defined by ElementFactory.
name
- The name of the entity.
externalID
- The external ID associated with the Entity, or null if
the Entity does not have an external ID (i.e. it is an internal entity).
isParameter
- =true if a parameter Entity; otherwise =false.
ndata
- The notation associated with the binary Entity, or null if
the Entity is a text Entity.
dtdHandler
fails.public TXNotation createNotation(java.lang.String name, ExternalID externalID) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that a Notation has been parsed. This method will notify any registered DTD handlers.
This method is defined by ElementFactory.
name
- The name of the Notation.
externalID
- The external ID associated with the Notation, or null if
the Notation does not have an external ID (i.e. it is an internal entity).
dtdHandler
fails.public TXText createText(char[] carray, int offset, int length, boolean ignorableWhitespace) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that Text has been parsed. This method will notify any registered document handlers.
This method is defined by ElementFactory.
carray
- an array of chracter including the actual content of the Text Node.
offset
- a position of starting content.
length
- a length of content
ignorableWhiteSpace
- The boolean indicator which determines whether white space
(blanks) is to be considered for this Text Node.
=true indicates whitespace is ignored; =false indicates
whitespace is significant.
documentHandler
fails.public TXCDATASection createCDATA(java.lang.String data) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that a CDATA section has been parsed. This method will notify any registered document handlers.
This method is defined by ElementFactory.
data
- The actual data of the CDATA section.
documentHandler
fails.public TXPI createPI(java.lang.String name, java.lang.String data) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that a processing instruction (PI) has been parsed. This method will notify any registered document handlers.
This method is defined by ElementFactory.
name
- The first token following the markup.
data
- From the character immediately after name to the
character immediately preceding the ?>
.
documentHandler
fails.public NamespacePI createNamespacePI(java.lang.String name, java.lang.String data, java.lang.String nsURI, java.lang.String prefixName, java.lang.String srcURI) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that a namespacePI has been parsed. This method will notify any registered document handlers.
This method is defined by ElementFactory.
name
- The first token following the markup (i.e. "xml:namespace").
data
- From the character immediately after the name to the character immediately preceding the ?>
.
nsURI
- The value of the ns=
attribute.
prefixName
- The value of the prefix=
attribute.
srcURI
- The value of the src=
attribute, or null.
documentHandler
fails.public StylesheetPI createStylesheetPI(java.lang.String name, java.lang.String data, java.lang.String type, java.lang.String hrefURI, java.lang.String title) throws java.lang.RuntimeException
Called by the XML4J parser in order to signal that a stylesheetPI has been parsed. This method will notify any registered document handlers.
This method is defined by ElementFactory.
name
- The first token following the markup (e.g. "xml:stylesheet"
).
data
- From the character immediately after name to the character immediately preceding the ?>
.
type
- The value of the type=
attribute.
hrefURI
- The value of the href=
attribute.
title
- The value of the title=
attribute, or null.
documentHandler
fails.Contents | Package | Class | Tree | Deprecated | Index | Help | |||
PREV | NEXT | SHOW LISTS | HIDE LISTS |