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.Parser
Constructor Summary | |
Parser(java.lang.String name)
ErrorListener and StreamProducer .
|
|
Parser(java.lang.String name,
ErrorListener errorListener,
StreamProducer streamProducer)
ErrorListener or StreamProducer .
|
Method Summary | |
void | addElementHandler(ElementHandler elementHandler)
|
void | addElementHandler(ElementHandler elementHandler,
java.lang.String elementTagName)
|
void | addNoRequiredAttributeHandler(NoRequiredAttributeHandler noRequiredAttributeHandler)
|
void | addPIHandler(PIHandler piHandler)
|
void | addPreRootHandler(PreRootHandler preRootHandler)
|
void | closeInputStream(Source source)
Removes the input stream currently in use. |
Source | getInputStream(java.lang.String name,
java.lang.String publicID,
java.lang.String systemID)
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, and the streamProducer specified when this parser was constructed. |
int | getNumberOfErrors()
|
int | getNumberOfWarnings()
|
int | getReaderBufferSize()
|
void | loadCatalog(java.io.Reader reader)
|
DTD | readDTDStream(java.io.InputStream inputStream)
|
DTD | readDTDStream(java.io.Reader reader)
|
DTD | readDTDStream(Source source)
|
TXDocument | readStream(java.io.InputStream inputStream)
|
TXDocument | readStream(java.io.Reader reader)
|
TXDocument | readStream(Source source)
|
void | setAllowJavaEncodingName(boolean isAllowJavaEncodingName)
|
void | setElementFactory(ElementFactory elementFactory)
|
void | setEndBy1stError(boolean isEndBy1stError)
|
void | setErrorNoByteMark(boolean isErrorNoByteMark)
ErrorListener .
|
void | setKeepComment(boolean isKeepComment)
TXComment Nodes are created by this parser when XML
comments are encountered.
|
void | setLocale(java.util.Locale locale)
|
void | setPreserveSpace(boolean isPreserveSpace)
|
void | setProcessNamespace(boolean isProcessNamespace)
|
void | setReaderBufferSize(int readerBufferSize)
|
void | setReferenceHandler(ReferenceHandler referenceHandler)
|
void | setTagHandler(TagHandler tagHandler)
|
void | setWarningNoDoctypeDecl(boolean isWarningNoDoctypeDecl)
ErrorListener .
|
void | setWarningNoXMLDecl(boolean isWarningNoXMLDecl)
ErrorListener .
|
void | setWarningRedefinedEntity(boolean isWarningRedefinedEntity)
ErrorListener .
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Parser(java.lang.String name)
ErrorListener
and StreamProducer
.
The default ErrorListener
and StreamProducer
are defined by
the Stderr
class.
name
- URL or filespec to use as the default input stream; if a filespec is
provided, this value can include a drive and directory spec.
This value is also used to associate a name with errors reported to the
default error listener that have a file parameter
=null
.
public Parser(java.lang.String name, ErrorListener errorListener, StreamProducer streamProducer)
ErrorListener
or StreamProducer
.
The default ErrorListener
and StreamProducer
are defined by
the Stderr
class.
name
- This parameter is only used if either errorListener or
streamProducer are allowed to default. If streamProducer
is allowed to default, this value is the URL or filespec to use as
the default input stream; if a filespec is provided, this value can
include a drive and directory spec. If errorListener is
allowed to default, this value is used to associate a name with
errors reported to the default error listener that have a
file parameter =null
.
errorListener
- Handler for error and warning events that are recognized by this
parser, or null if to use the default listener.
streamProducer
- Mechanism for manipulating this parser's input stream, or
null if to use the default stream producer.
Method Detail |
public void setLocale(java.util.Locale locale)
By default, the current user locale's resource bundle is used. If no messages exist for the requested locale, US English messages are used.
locale
- A Java Locale object.
public void setElementFactory(ElementFactory elementFactory)
DefaultElementFactory
is used.
elementFactory
- Factory to use to create and initialize objects.
public Source getInputStream(java.lang.String name, java.lang.String publicID, java.lang.String systemID) throws java.io.IOException
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, and the streamProducer specified when this parser was constructed.
name
- The name to be associated with the input stream. For example,
this name could be the public ID of an external ID, or a local filename.
publicID
- Entity's public ID, or null if no public ID (see ExternalID for details).
systemID
- Entity's system ID.
public void closeInputStream(Source source)
Removes the input stream currently in use.
source
- Source of the input stream to be closed.
public void loadCatalog(java.io.Reader reader) throws java.io.IOException
reader
- Character input stream reader.
public void setTagHandler(TagHandler tagHandler)
tagHandler
- Handler to be registered.
public void setReferenceHandler(ReferenceHandler referenceHandler)
referenceHandler
- Handler to be registered.
public void addPreRootHandler(PreRootHandler preRootHandler)
preRootHandler
- Handler to be registered.
public void addPIHandler(PIHandler piHandler)
piHandler
- Handler to be registered.
public void addElementHandler(ElementHandler elementHandler)
elementHandler
- Handler to be registered.
public void addElementHandler(ElementHandler elementHandler, java.lang.String elementTagName)
elementHandler
- Handler to be registered for the specified elementTagName.
elementTagName
- Element name to be watched for by this parser. If the
Element's name has a namespace prefix, that prefix should
be included.
public void addNoRequiredAttributeHandler(NoRequiredAttributeHandler noRequiredAttributeHandler)
By default, no required attribute handlers are registered to this parser.
noRequiredAttributeHandler
- Handler to be registered.
public int getNumberOfErrors()
public int getNumberOfWarnings()
public void setKeepComment(boolean isKeepComment)
TXComment
Nodes are created by this parser when XML
comments are encountered.
By default, TXComment
Nodes are created by this parser.
isKeepComment
- =true
means maintain parsed comments;
=false
means drop comments when creating object tree.
public void setProcessNamespace(boolean isProcessNamespace)
TXElement, TXPI, and TXAttribute
Nodes. If namespaces
are respected, the methods defined by the Namespace
interface will
function properly in these Nodes.
By default, namespaces are NOT respected by this parser.
isProcessNamespace
- =true
means parse for namespaces;
=false
means ignore namespaces when parsing.
public void setAllowJavaEncodingName(boolean isAllowJavaEncodingName)
MIME2Java
class is provided to facilitate conversion when Java encoding names are not allowed.
By default, Java encoding names are NOT allowed on xmlEncoding parameters by this parser.
isAllowJavaEncodingName
- =true
means Java encoding names are allowed;
=false
means MIME charset names must be used.
public void setPreserveSpace(boolean isPreserveSpace)
xml:space
attribute.
By default, space is not to be preserved in the parsed document.
isPreserveSpace
- =true
space is to be preserved;
=false
space is to be ignored.
public void setErrorNoByteMark(boolean isErrorNoByteMark)
ErrorListener
.
By default, this condition is reported by this parser as an error.
isErrorNoByteMark
- =true
means report condition as an error;
=false
means ignore this condition.
public void setWarningRedefinedEntity(boolean isWarningRedefinedEntity)
ErrorListener
.
By default, this condition is reported by this parser as a warning.
isWarningRedefinedEntity
- =true
means report condition as a warning;
=false
means ignore this condition.
public void setWarningNoXMLDecl(boolean isWarningNoXMLDecl)
ErrorListener
.
By default, this condition is reported by this parser as a warning.
isWarningNoXMLDecl
- =true
means report condition as a warning;
=false
means ignore this condition.
public void setWarningNoDoctypeDecl(boolean isWarningNoDoctypeDecl)
ErrorListener
.
By default, this condition is NOT reported by this parser as a warning.
isWarningNoXMLDecl
- =true
means report condition as a warning;
=false
means ignore this condition.
public void setEndBy1stError(boolean isEndBy1stError)
By default, this parser continues parsing after an error occurs.
isEndBy1stError
- =true
means initial error or exception ends processing;
=false
means processing continues until document is fully parsed.
public TXDocument readStream(java.io.InputStream inputStream)
TXDocument#getDocumentElement
.
Once this method is invoked, the parser instance is of no further use, and should NOT be reused.
inputStream
- Byte-stream-oriented data source.
public TXDocument readStream(java.io.Reader reader)
TXDocument#getDocumentElement
.
Once this method is invoked, the parser instance is of no further use, and should NOT be reused.
reader
- Character-stream-oriented data source.
public TXDocument readStream(Source source)
TXDocument#getDocumentElement
.
Once this method is invoked, the parser instance is of no further use, and should NOT be reused.
source
- Byte-stream-oriented or character-stream-oriented data source.
public DTD readDTDStream(java.io.InputStream inputStream) throws java.io.IOException
DTD#externalElements
.
Once this method is invoked, the parser instance is of no further use, and should NOT be reused.
inputStream
- Byte-stream-oriented data source.
public DTD readDTDStream(java.io.Reader reader) throws java.io.IOException
DTD#externalElements
.
Once this method is invoked, the parser instance is of no further use, and should NOT be reused.
reader
- Character-stream-oriented data source.
public DTD readDTDStream(Source source) throws java.io.IOException
DTD#externalElements
.
Once this method is invoked, the parser instance is of no further use, and should NOT be reused.
source
- Byte-stream-oriented or character-stream-oriented data source.
public int getReaderBufferSize()
public void setReaderBufferSize(int readerBufferSize)
The default buffer size is large enough for most purposes.
readerBufferSize
- Size of this parser's character-stream-oriented input buffer.
Contents | Package | Class | Tree | Deprecated | Index | Help | |||
PREV | NEXT | SHOW LISTS | HIDE LISTS |