org.apache.commons.digester
クラス Digester

org.apache.commons.digester.Digester
直系の既知のサブクラス:
RSSDigester

public class Digester

A Digester processes an XML input stream by matching a series of element nesting patterns to execute Rules that have been added prior to the start of parsing. This package was inspired by the XmlMapper class that was part of Tomcat 3.0 and 3.1, but is organized somewhat differently.

See the Digester Developer Guide for more information.

IMPLEMENTATION NOTE - A single Digester instance may only be used within the context of a single thread at a time, and a call to parse() must be completed before another can be initiated even from the same thread.

バージョン:
$Revision: 1.23 $ $Date: 2001/10/16 23:46:34 $
作成者:
Craig McClanahan, Scott Sanders

フィールドの概要
protected  java.lang.StringBuffer bodyText
          The body text of the current element.
protected  org.apache.commons.collections.ArrayStack bodyTexts
          The stack of body text string buffers for surrounding elements.
protected  java.lang.ClassLoader classLoader
          The class loader to use for instantiating application objects.
protected  boolean configured
          Has this Digester been configured yet?
protected  int debug
          The debugging detail level of this component.
protected  java.util.HashMap dtds
          The URLs of DTDs that have been registered, keyed by the public identifier that corresponds.
protected  org.xml.sax.ErrorHandler errorHandler
          The application-supplied error handler that is notified when parsing warnings, errors, or fatal errors occur.
protected static javax.xml.parsers.SAXParserFactory factory
          The SAXParserFactory that is created the first time we need it.
protected  org.xml.sax.Locator locator
          The Locator associated with our parser.
protected  java.lang.String match
          The current match pattern for nested element processing.
protected  boolean namespaceAware
          Do we want a "namespace aware" parser?
protected  java.util.HashMap namespaces
          Registered namespaces we are currently processing.
protected  org.apache.commons.collections.ArrayStack params
          The parameters stack being utilized by CallMethodRule and CallParamRule rules.
protected  javax.xml.parsers.SAXParser parser
          The SAXParser we will use to parse the input stream.
protected  java.lang.String publicId
          The public identifier of the DTD we are currently parsing under (if any).
protected  org.xml.sax.XMLReader reader
          The XMLReader used to parse digester rules.
protected  java.lang.Object root
          The "root" element of the stack (in other words, the last object that was popped.
protected  Rules rules
          The Rules implementation containing our collection of Rule instances and associated matching policy.
protected  org.apache.commons.collections.ArrayStack stack
          The object stack being constructed.
protected  boolean useContextClassLoader
          Do we want to use the Context ClassLoader when loading classes for instantiating new objects?
protected  boolean validating
          Do we want to use a validating parser?
protected  java.io.PrintWriter writer
          The PrintWriter to which we should send log output, or null to write to System.out.
 
コンストラクタの概要
Digester()
          Construct a new Digester with default properties.
Digester(javax.xml.parsers.SAXParser parser)
          Construct a new Digester, allowing a SAXParser to be passed in.
Digester(org.xml.sax.XMLReader reader)
          Construct a new Digester, allowing an XMLReader to be passed in.
 
メソッドの概要
 void addCallMethod(java.lang.String pattern, java.lang.String methodName, int paramCount)
          Add an "call method" rule for the specified parameters.
 void addCallMethod(java.lang.String pattern, java.lang.String methodName, int paramCount, java.lang.Class[] paramTypes)
          Add an "call method" rule for the specified parameters.
 void addCallMethod(java.lang.String pattern, java.lang.String methodName, int paramCount, java.lang.String[] paramTypes)
          Add an "call method" rule for the specified parameters.
 void addCallParam(java.lang.String pattern, int paramIndex)
          Add a "call parameter" rule for the specified parameters.
 void addCallParam(java.lang.String pattern, int paramIndex, java.lang.String attributeName)
          Add a "call parameter" rule for the specified parameters.
 void addFactoryCreate(java.lang.String pattern, ObjectCreationFactory creationFactory)
          Add a "factory create" rule for the specified parameters.
 void addFactoryCreate(java.lang.String pattern, java.lang.String className)
          Add a "factory create" rule for the specified parameters.
 void addFactoryCreate(java.lang.String pattern, java.lang.String className, java.lang.String attributeName)
          Add a "factory create" rule for the specified parameters.
 void addObjectCreate(java.lang.String pattern, java.lang.String className)
          Add an "object create" rule for the specified parameters.
 void addObjectCreate(java.lang.String pattern, java.lang.String className, java.lang.String attributeName)
          Add an "object create" rule for the specified parameters.
 void addRule(java.lang.String pattern, Rule rule)
          Register a new Rule matching the specified pattern.
 void addRuleSet(RuleSet ruleSet)
          Register a set of Rule instances defined in a RuleSet.
 void addSetNext(java.lang.String pattern, java.lang.String methodName)
          Add a "set next" rule for the specified parameters.
 void addSetNext(java.lang.String pattern, java.lang.String methodName, java.lang.String paramType)
          Add a "set next" rule for the specified parameters.
 void addSetProperties(java.lang.String pattern)
          Add a "set properties" rule for the specified parameters.
 void addSetProperty(java.lang.String pattern, java.lang.String name, java.lang.String value)
          Add a "set property" rule for the specified parameters.
 void addSetTop(java.lang.String pattern, java.lang.String methodName)
          Add a "set top" rule for the specified parameters.
 void addSetTop(java.lang.String pattern, java.lang.String methodName, java.lang.String paramType)
          Add a "set top" rule for the specified parameters.
 void characters(char[] buffer, int start, int length)
          Process notification of character data received from the body of an XML element.
 void clear()
          Clear the current contents of the object stack.
protected  void configure()
          Provide a hook for lazy configuration of this Digester instance.
protected  org.xml.sax.SAXException createSAXException(java.lang.Exception e)
          Create a SAX exception which also understands about the location in the digester file where the exception occurs
protected  org.xml.sax.SAXException createSAXException(java.lang.String message)
          Create a SAX exception which also understands about the location in the digester file where the exception occurs
protected  org.xml.sax.SAXException createSAXException(java.lang.String message, java.lang.Exception e)
          Create a SAX exception which also understands about the location in the digester file where the exception occurs
 void endDocument()
          Process notification of the end of the document being reached.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Process notification of the end of an XML element being reached.
 void endPrefixMapping(java.lang.String prefix)
          Process notification that a namespace prefix is going out of scope.
 void error(org.xml.sax.SAXParseException exception)
          Forward notification of a parsing error to the application supplied error handler (if any).
 void fatalError(org.xml.sax.SAXParseException exception)
          Forward notification of a fatal parsing error to the application supplied error handler (if any).
 java.lang.String findNamespaceURI(java.lang.String prefix)
          Return the currently mapped namespace URI for the specified prefix, if any; otherwise return null.
 java.lang.ClassLoader getClassLoader()
          Return the class loader to be used for instantiating application objects when required.
 int getCount()
          Return the current depth of the element stack.
 int getDebug()
          Return the debugging detail level of this Digester.
 org.xml.sax.ErrorHandler getErrorHandler()
          Return the error handler for this Digester.
 boolean getNamespaceAware()
          Return the "namespace aware" flag for parsers we create.
 javax.xml.parsers.SAXParser getParser()
          Return the SAXParser we will use to parse the input stream.
 java.lang.String getPublicId()
          Return the public identifier of the DTD we are currently parsing under, if any.
 org.xml.sax.XMLReader getReader()
          By setting the reader in the constructor, you can bypass JAXP and be able to use digester in Weblogic 6.0.
(パッケージプライベート)  java.util.Map getRegistrations()
          Return the set of DTD URL registrations, keyed by public identifier.
 java.lang.String getRuleNamespaceURI()
          Return the namespace URI that will be applied to all subsequently added Rule objects.
 Rules getRules()
          Return the Rules implementation object containing our rules collection and associated matching policy.
(パッケージプライベート)  java.util.List getRules(java.lang.String match)
          推奨されていません。 Call match() on the Rules implementation returned by getRules()
 boolean getUseContextClassLoader()
          Return the boolean as to whether the context classloader should be used.
 boolean getValidating()
          Return the validating parser flag.
 java.io.PrintWriter getWriter()
          Return the logging writer for this Digester.
 void ignorableWhitespace(char[] buffer, int start, int len)
          Process notification of ignorable whitespace received from the body of an XML element.
 void log(java.lang.String message)
          Log a message to the log writer associated with this context.
 void log(java.lang.String message, java.lang.Throwable exception)
          Log a message and associated exception to the log writer associated with this context.
 void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Receive notification of a notation declaration event.
 java.lang.Object parse(java.io.File file)
          Parse the content of the specified file using this Digester.
 java.lang.Object parse(org.xml.sax.InputSource input)
          Parse the content of the specified input source using this Digester.
 java.lang.Object parse(java.io.InputStream input)
          Parse the content of the specified input stream using this Digester.
 java.lang.Object parse(java.lang.String uri)
          Parse the content of the specified URI using this Digester.
 java.lang.Object peek()
          Return the top object on the stack without removing it.
 java.lang.Object peek(int n)
          Return the n'th object down the stack, where 0 is the top element and [getCount()-1] is the bottom element.
(パッケージプライベート)  java.lang.Object peekParams()
          Return the top object on the stack without removing it.
(パッケージプライベート)  java.lang.Object peekParams(int n)
          Return the n'th object down the stack, where 0 is the top element and [getCount()-1] is the bottom element.
 java.lang.Object pop()
          Pop the top object off of the stack, and return it.
(パッケージプライベート)  java.lang.Object popParams()
          Pop the top object off of the stack, and return it.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Process notification of a processing instruction that was encountered.
 void push(java.lang.Object object)
          Push a new object onto the top of the object stack.
(パッケージプライベート)  void pushParams(java.lang.Object object)
          Push a new object onto the top of the object stack.
 void register(java.lang.String publicId, java.lang.String dtdURL)
          Register the specified DTD URL for the specified public identifier.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolve the requested external entity.
 void setClassLoader(java.lang.ClassLoader classLoader)
          Set the class loader to be used for instantiating application objects when required.
 void setDebug(int debug)
          Set the debugging detail level of this Digester.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Set the document locator associated with our parser.
 void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
          Set the error handler for this Digester.
 void setNamespaceAware(boolean namespaceAware)
          Set the "namespace aware" flag for parsers we create.
 void setRuleNamespaceURI(java.lang.String ruleNamespaceURI)
          Set the namespace URI that will be applied to all subsequently added Rule objects.
 void setRules(Rules rules)
          Set the Rules implementation object containing our rules collection and associated matching policy.
 void setUseContextClassLoader(boolean use)
          Determine whether to use the Context ClassLoader (the one found by calling Thread.currentThread().getContextClassLoader()) to resolve/load classes that are defined in various rules.
 void setValidating(boolean validating)
          Set the validating parser flag.
 void setWriter(java.io.PrintWriter writer)
          Set the logging writer for this Digester.
 void skippedEntity(java.lang.String name)
          Process notification of a skipped entity.
 void startDocument()
          Process notification of the beginning of the document being reached.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes list)
          Process notification of the start of an XML element being reached.
 void startPrefixMapping(java.lang.String prefix, java.lang.String namespaceURI)
          Process notification that a namespace prefix is coming in to scope.
 void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation)
          Receive notification of an unparsed entity declaration event.
 void warning(org.xml.sax.SAXParseException exception)
          Forward notification of a parse warning to the application supplied error handler (if any).
 

フィールドの詳細

bodyText

protected java.lang.StringBuffer bodyText
The body text of the current element.

bodyTexts

protected org.apache.commons.collections.ArrayStack bodyTexts
The stack of body text string buffers for surrounding elements.

classLoader

protected java.lang.ClassLoader classLoader
The class loader to use for instantiating application objects. If not specified, the context class loader, or the class loader used to load Digester itself, is used, based on the value of the useContextClassLoader variable.

configured

protected boolean configured
Has this Digester been configured yet?

debug

protected int debug
The debugging detail level of this component.

dtds

protected java.util.HashMap dtds
The URLs of DTDs that have been registered, keyed by the public identifier that corresponds.

errorHandler

protected org.xml.sax.ErrorHandler errorHandler
The application-supplied error handler that is notified when parsing warnings, errors, or fatal errors occur.

factory

protected static javax.xml.parsers.SAXParserFactory factory
The SAXParserFactory that is created the first time we need it.

locator

protected org.xml.sax.Locator locator
The Locator associated with our parser.

match

protected java.lang.String match
The current match pattern for nested element processing.

namespaceAware

protected boolean namespaceAware
Do we want a "namespace aware" parser?

namespaces

protected java.util.HashMap namespaces
Registered namespaces we are currently processing. The key is the namespace prefix that was declared in the document. The value is an ArrayStack of the namespace URIs this prefix has been mapped to -- the top Stack element is the most current one. (This architecture is required because documents can declare nested uses of the same prefix for different Namespace URIs).

params

protected org.apache.commons.collections.ArrayStack params
The parameters stack being utilized by CallMethodRule and CallParamRule rules.

parser

protected javax.xml.parsers.SAXParser parser
The SAXParser we will use to parse the input stream.

publicId

protected java.lang.String publicId
The public identifier of the DTD we are currently parsing under (if any).

reader

protected org.xml.sax.XMLReader reader
The XMLReader used to parse digester rules.

root

protected java.lang.Object root
The "root" element of the stack (in other words, the last object that was popped.

rules

protected Rules rules
The Rules implementation containing our collection of Rule instances and associated matching policy. If not established before the first rule is added, a default implementation will be provided.

stack

protected org.apache.commons.collections.ArrayStack stack
The object stack being constructed.

useContextClassLoader

protected boolean useContextClassLoader
Do we want to use the Context ClassLoader when loading classes for instantiating new objects? Default is false.

validating

protected boolean validating
Do we want to use a validating parser?

writer

protected java.io.PrintWriter writer
The PrintWriter to which we should send log output, or null to write to System.out.
コンストラクタの詳細

Digester

public Digester()
Construct a new Digester with default properties.

Digester

public Digester(javax.xml.parsers.SAXParser parser)
Construct a new Digester, allowing a SAXParser to be passed in. This allows Digester to be used in environments which are unfriendly to JAXP1.1 (such as WebLogic 6.0). Thanks for the request to change go to James House (james@interobjective.com). This may help in places where you are able to load JAXP 1.1 classes yourself.

Digester

public Digester(org.xml.sax.XMLReader reader)
Construct a new Digester, allowing an XMLReader to be passed in. This allows Digester to be used in environments which are unfriendly to JAXP1.1 (such as WebLogic 6.0). Note that if you use this option you have to configure namespace and validation support yourself, as these properties only affect the SAXParser and emtpy constructor.
メソッドの詳細

findNamespaceURI

public java.lang.String findNamespaceURI(java.lang.String prefix)
Return the currently mapped namespace URI for the specified prefix, if any; otherwise return null. These mappings come and go dynamically as the document is parsed.
パラメータ:
prefix - Prefix to look up

getClassLoader

public java.lang.ClassLoader getClassLoader()
Return the class loader to be used for instantiating application objects when required. This is determined based upon the following rules:

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader to be used for instantiating application objects when required.
パラメータ:
classLoader - The new class loader to use, or null to revert to the standard rules

getCount

public int getCount()
Return the current depth of the element stack.

getDebug

public int getDebug()
Return the debugging detail level of this Digester.

setDebug

public void setDebug(int debug)
Set the debugging detail level of this Digester.
パラメータ:
debug - The new debugging detail level

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Return the error handler for this Digester.

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Set the error handler for this Digester.
パラメータ:
errorHandler - The new error handler

getNamespaceAware

public boolean getNamespaceAware()
Return the "namespace aware" flag for parsers we create.

setNamespaceAware

public void setNamespaceAware(boolean namespaceAware)
Set the "namespace aware" flag for parsers we create.
パラメータ:
namespaceAware - The new "namespace aware" flag

getPublicId

public java.lang.String getPublicId()
Return the public identifier of the DTD we are currently parsing under, if any.

getRuleNamespaceURI

public java.lang.String getRuleNamespaceURI()
Return the namespace URI that will be applied to all subsequently added Rule objects.

setRuleNamespaceURI

public void setRuleNamespaceURI(java.lang.String ruleNamespaceURI)
Set the namespace URI that will be applied to all subsequently added Rule objects.
パラメータ:
ruleNamespaceURI - Namespace URI that must match on all subsequently added rules, or null for matching regardless of the current namespace URI

getParser

public javax.xml.parsers.SAXParser getParser()
Return the SAXParser we will use to parse the input stream. If there is a problem creating the parser, return null.

getReader

public org.xml.sax.XMLReader getReader()
By setting the reader in the constructor, you can bypass JAXP and be able to use digester in Weblogic 6.0.

getRules

public Rules getRules()
Return the Rules implementation object containing our rules collection and associated matching policy. If none has been established, a default implementation will be created and returned.

setRules

public void setRules(Rules rules)
Set the Rules implementation object containing our rules collection and associated matching policy.
パラメータ:
rules - New Rules implementation

getValidating

public boolean getValidating()
Return the validating parser flag.

setValidating

public void setValidating(boolean validating)
Set the validating parser flag. This must be called before parse() is called the first time.
パラメータ:
validating - The new validating parser flag.

getWriter

public java.io.PrintWriter getWriter()
Return the logging writer for this Digester.

setWriter

public void setWriter(java.io.PrintWriter writer)
Set the logging writer for this Digester.
パラメータ:
writer - The new PrintWriter, or null for System.out.

getUseContextClassLoader

public boolean getUseContextClassLoader()
Return the boolean as to whether the context classloader should be used.

setUseContextClassLoader

public void setUseContextClassLoader(boolean use)
Determine whether to use the Context ClassLoader (the one found by calling Thread.currentThread().getContextClassLoader()) to resolve/load classes that are defined in various rules. If not using Context ClassLoader, then the class-loading defaults to using the calling-class' ClassLoader.
パラメータ:
boolean - determines whether to use Context ClassLoader.

characters

public void characters(char[] buffer,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Process notification of character data received from the body of an XML element.
パラメータ:
buffer - The characters from the XML document
start - Starting offset into the buffer
length - Number of characters from the buffer
例外:
SAXException - if a parsing error is to be reported

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Process notification of the end of the document being reached.
例外:
SAXException - if a parsing error is to be reported

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Process notification of the end of an XML element being reached.
パラメータ:
uri - - 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 name (without prefix), or the empty string if Namespace processing is not being performed.
qName - - The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.
例外:
SAXException - if a parsing error is to be reported

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Process notification that a namespace prefix is going out of scope.
パラメータ:
prefix - Prefix that is going out of scope
例外:
SAXException - if a parsing error is to be reported

ignorableWhitespace

public void ignorableWhitespace(char[] buffer,
                                int start,
                                int len)
                         throws org.xml.sax.SAXException
Process notification of ignorable whitespace received from the body of an XML element.
パラメータ:
buffer - The characters from the XML document
start - Starting offset into the buffer
length - Number of characters from the buffer
例外:
SAXException - if a parsing error is to be reported

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Process notification of a processing instruction that was encountered.
パラメータ:
target - The processing instruction target
data - The processing instruction data (if any)
例外:
SAXException - if a parsing error is to be reported

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Set the document locator associated with our parser.
パラメータ:
locator - The new locator

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Process notification of a skipped entity.
パラメータ:
name - Name of the skipped entity
例外:
SAXException - if a parsing error is to be reported

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Process notification of the beginning of the document being reached.
例外:
SAXException - if a parsing error is to be reported

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes list)
                  throws org.xml.sax.SAXException
Process notification of the start of an XML element being reached.
パラメータ:
uri - 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 name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.\
list - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
例外:
SAXException - if a parsing error is to be reported

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String namespaceURI)
                        throws org.xml.sax.SAXException
Process notification that a namespace prefix is coming in to scope.
パラメータ:
prefix - Prefix that is being declared
namespaceURI - Corresponding namespace URI being mapped to
例外:
SAXException - if a parsing error is to be reported

notationDecl

public void notationDecl(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
Receive notification of a notation declaration event.
パラメータ:
name - The notation name
publicId - The public identifier (if any)
systemId - The system identifier (if any)

unparsedEntityDecl

public void unparsedEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String notation)
Receive notification of an unparsed entity declaration event.
パラメータ:
name - The unparsed entity name
publicId - The public identifier (if any)
systemId - The system identifier (if any)
notation - The name of the associated notation

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException
Resolve the requested external entity.
パラメータ:
publicId - The public identifier of the entity being referenced
systemId - The system identifier of the entity being referenced
例外:
SAXException - if a parsing exception occurs

error

public void error(org.xml.sax.SAXParseException exception)
           throws org.xml.sax.SAXException
Forward notification of a parsing error to the application supplied error handler (if any).
パラメータ:
exception - The error information
例外:
SAXException - if a parsing exception occurs

fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
                throws org.xml.sax.SAXException
Forward notification of a fatal parsing error to the application supplied error handler (if any).
パラメータ:
exception - The fatal error information
例外:
SAXException - if a parsing exception occurs

warning

public void warning(org.xml.sax.SAXParseException exception)
             throws org.xml.sax.SAXException
Forward notification of a parse warning to the application supplied error handler (if any).
パラメータ:
exception - The warning information
例外:
SAXException - if a parsing exception occurs

log

public void log(java.lang.String message)
Log a message to the log writer associated with this context.
パラメータ:
message - The message to be logged

log

public void log(java.lang.String message,
                java.lang.Throwable exception)
Log a message and associated exception to the log writer associated with this context.
パラメータ:
message - The message to be logged
exception - The associated exception to be logged

parse

public java.lang.Object parse(java.io.File file)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Parse the content of the specified file using this Digester. Returns the root element from the object stack (if any).
パラメータ:
file - File containing the XML data to be parsed
例外:
java.io.IOException - if an input/output error occurs
SAXException - if a parsing exception occurs

parse

public java.lang.Object parse(org.xml.sax.InputSource input)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Parse the content of the specified input source using this Digester. Returns the root element from the object stack (if any).
パラメータ:
input - Input source containing the XML data to be parsed
例外:
java.io.IOException - if an input/output error occurs
SAXException - if a parsing exception occurs

parse

public java.lang.Object parse(java.io.InputStream input)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Parse the content of the specified input stream using this Digester. Returns the root element from the object stack (if any).
パラメータ:
input - Input stream containing the XML data to be parsed
例外:
java.io.IOException - if an input/output error occurs
SAXException - if a parsing exception occurs

parse

public java.lang.Object parse(java.lang.String uri)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Parse the content of the specified URI using this Digester. Returns the root element from the object stack (if any).
パラメータ:
uri - URI containing the XML data to be parsed
例外:
java.io.IOException - if an input/output error occurs
SAXException - if a parsing exception occurs

register

public void register(java.lang.String publicId,
                     java.lang.String dtdURL)
Register the specified DTD URL for the specified public identifier. This must be called before the first call to parse().
パラメータ:
publicId - Public identifier of the DTD to be resolved
dtdURL - The URL to use for reading this DTD

addRule

public void addRule(java.lang.String pattern,
                    Rule rule)
Register a new Rule matching the specified pattern.
パラメータ:
pattern - Element matching pattern
rule - Rule to be registered

addRuleSet

public void addRuleSet(RuleSet ruleSet)
Register a set of Rule instances defined in a RuleSet.
パラメータ:
ruleSet - The RuleSet instance to configure from

addCallMethod

public void addCallMethod(java.lang.String pattern,
                          java.lang.String methodName,
                          int paramCount)
Add an "call method" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
methodName - Method name to be called
paramCount - Number of expected parameters (or zero for a single parameter from the body of this element)

addCallMethod

public void addCallMethod(java.lang.String pattern,
                          java.lang.String methodName,
                          int paramCount,
                          java.lang.String[] paramTypes)
Add an "call method" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
methodName - Method name to be called
paramCount - Number of expected parameters (or zero for a single parameter from the body of this element)
paramTypes - Set of Java class names for the types of the expected parameters (if you wish to use a primitive type, specify the corresonding Java wrapper class instead, such as java.lang.Boolean for a boolean parameter)

addCallMethod

public void addCallMethod(java.lang.String pattern,
                          java.lang.String methodName,
                          int paramCount,
                          java.lang.Class[] paramTypes)
Add an "call method" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
methodName - Method name to be called
paramCount - Number of expected parameters (or zero for a single parameter from the body of this element)
paramTypes - The Java class names of the arguments (if you wish to use a primitive type, specify the corresonding Java wrapper class instead, such as java.lang.Boolean for a boolean parameter)

addCallParam

public void addCallParam(java.lang.String pattern,
                         int paramIndex)
Add a "call parameter" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
paramIndex - Zero-relative parameter index to set (from the body of this element)

addCallParam

public void addCallParam(java.lang.String pattern,
                         int paramIndex,
                         java.lang.String attributeName)
Add a "call parameter" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
paramIndex - Zero-relative parameter index to set (from the specified attribute)
attributeName - Attribute whose value is used as the parameter value

addFactoryCreate

public void addFactoryCreate(java.lang.String pattern,
                             java.lang.String className)
Add a "factory create" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
className - Java class name of the object creation factory class

addFactoryCreate

public void addFactoryCreate(java.lang.String pattern,
                             java.lang.String className,
                             java.lang.String attributeName)
Add a "factory create" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
className - Java class name of the object creation factory class
attributeName - Attribute name which, if present, overrides the value specified by className

addFactoryCreate

public void addFactoryCreate(java.lang.String pattern,
                             ObjectCreationFactory creationFactory)
Add a "factory create" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
creationFactory - Previously instantiated ObjectCreationFactory to be utilized

addObjectCreate

public void addObjectCreate(java.lang.String pattern,
                            java.lang.String className)
Add an "object create" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
className - Java class name to be created

addObjectCreate

public void addObjectCreate(java.lang.String pattern,
                            java.lang.String className,
                            java.lang.String attributeName)
Add an "object create" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
className - Default Java class name to be created
attributeName - Attribute name that optionally overrides the default Java class name to be created

addSetNext

public void addSetNext(java.lang.String pattern,
                       java.lang.String methodName)
Add a "set next" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
methodName - Method name to call on the parent element

addSetNext

public void addSetNext(java.lang.String pattern,
                       java.lang.String methodName,
                       java.lang.String paramType)
Add a "set next" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
methodName - Method name to call on the parent element
paramType - Java class name of the expected parameter type (if you wish to use a primitive type, specify the corresonding Java wrapper class instead, such as java.lang.Boolean for a boolean parameter)

addSetProperties

public void addSetProperties(java.lang.String pattern)
Add a "set properties" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern

addSetProperty

public void addSetProperty(java.lang.String pattern,
                           java.lang.String name,
                           java.lang.String value)
Add a "set property" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
name - Attribute name containing the property name to be set
value - Attribute name containing the property value to set

addSetTop

public void addSetTop(java.lang.String pattern,
                      java.lang.String methodName)
Add a "set top" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
methodName - Method name to call on the parent element

addSetTop

public void addSetTop(java.lang.String pattern,
                      java.lang.String methodName,
                      java.lang.String paramType)
Add a "set top" rule for the specified parameters.
パラメータ:
pattern - Element matching pattern
methodName - Method name to call on the parent element
paramType - Java class name of the expected parameter type (if you wish to use a primitive type, specify the corresonding Java wrapper class instead, such as java.lang.Boolean for a boolean parameter)

clear

public void clear()
Clear the current contents of the object stack.

peek

public java.lang.Object peek()
Return the top object on the stack without removing it. If there are no objects on the stack, return null.

peek

public java.lang.Object peek(int n)
Return the n'th object down the stack, where 0 is the top element and [getCount()-1] is the bottom element. If the specified index is out of range, return null.
パラメータ:
n - Index of the desired element, where 0 is the top of the stack, 1 is the next element down, and so on.

pop

public java.lang.Object pop()
Pop the top object off of the stack, and return it. If there are no objects on the stack, return null.

push

public void push(java.lang.Object object)
Push a new object onto the top of the object stack.
パラメータ:
object - The new object

configure

protected void configure()
Provide a hook for lazy configuration of this Digester instance. The default implementation does nothing, but subclasses can override as needed.

getRegistrations

java.util.Map getRegistrations()
Return the set of DTD URL registrations, keyed by public identifier.

getRules

java.util.List getRules(java.lang.String match)
推奨されていません。 Call match() on the Rules implementation returned by getRules()

Return the set of rules that apply to the specified match position. The selected rules are those that match exactly, or those rules that specify a suffix match and the tail of the rule matches the current match position. Exact matches have precedence over suffix matches, then (among suffix matches) the longest match is preferred.
パラメータ:
match - The current match position

peekParams

java.lang.Object peekParams()
Return the top object on the stack without removing it. If there are no objects on the stack, return null.

peekParams

java.lang.Object peekParams(int n)
Return the n'th object down the stack, where 0 is the top element and [getCount()-1] is the bottom element. If the specified index is out of range, return null.
パラメータ:
n - Index of the desired element, where 0 is the top of the stack, 1 is the next element down, and so on.

popParams

java.lang.Object popParams()
Pop the top object off of the stack, and return it. If there are no objects on the stack, return null.

pushParams

void pushParams(java.lang.Object object)
Push a new object onto the top of the object stack.
パラメータ:
object - The new object

createSAXException

protected org.xml.sax.SAXException createSAXException(java.lang.String message,
                                                      java.lang.Exception e)
Create a SAX exception which also understands about the location in the digester file where the exception occurs
戻り値:
the new exception

createSAXException

protected org.xml.sax.SAXException createSAXException(java.lang.Exception e)
Create a SAX exception which also understands about the location in the digester file where the exception occurs
戻り値:
the new exception

createSAXException

protected org.xml.sax.SAXException createSAXException(java.lang.String message)
Create a SAX exception which also understands about the location in the digester file where the exception occurs
戻り値:
the new exception


Copyright (c) 2001 - Apache Software Foundation