org.apache.catalina.util.xml
クラス XmlMapper

java.lang.Object
  |
  +--org.xml.sax.HandlerBase
        |
        +--org.apache.catalina.util.xml.XmlMapper
すべての実装インタフェース:
org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, SaxContext

public class XmlMapper
extends org.xml.sax.HandlerBase
implements SaxContext

SAX Handler - it will read the XML and construct java objects

作成者:
costin@dnt.ro

コンストラクタの概要
XmlMapper()
           
 
メソッドの概要
 XmlAction addChild(java.lang.String parentM, java.lang.String argType)
          For the last 2 objects in stack, create a parent-child relation by invokeing parent.parentM with the child as parameter ArgType is the parameter expected by addParent ( null use the current object type)
 void addRule(java.lang.String path, XmlAction action)
           
 void characters(char[] buf, int offset, int len)
           
 void endDocument()
           
 void endElement(java.lang.String tag)
           
 void error(org.xml.sax.SAXParseException e)
           
 org.xml.sax.AttributeList getAttributeList(int pos)
          Access attributes of a particular tag
 java.lang.String getBody()
          Body of the last tag
 int getDebug()
           
 java.util.Stack getObjectStack()
          We maintain a stack to keep java objects that are generated as result of parsing.
 java.lang.String getPublicId()
           
 java.lang.Object getRoot()
          The root object is either set by caller before starting the parse or can be created using the first tag.
 java.lang.String getTag(int pos)
          Access a particular tag
 int getTagCount()
          Depth of the tag stack.
 boolean getValidating()
           
 void ignorableWhitespace(char[] buf, int offset, int len)
           
 void log(java.lang.String msg)
           
 XmlAction methodParam(int ord)
          Extract the method param from the body of the tag
 XmlAction methodParam(int ord, java.lang.String attrib)
          Extract the method param from a tag attribute
 XmlAction methodSetter(java.lang.String method, int paramC)
          If a tag matches, invoke a method on the current object.
 XmlAction methodSetter(java.lang.String method, int paramC, java.lang.String[] paramTypes)
          If a tag matches, invoke a method on the current object.
 void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
           
 XmlAction objectCreate(java.lang.String classN)
          Create an object using for a matching tag with the given class name
 XmlAction objectCreate(java.lang.String classN, java.lang.String attrib)
          Create an object using an attribute value as the class name If no attribute use classN as a default.
 XmlAction popStack()
          Pop the object stack
 void processingInstruction(java.lang.String name, java.lang.String instruction)
           
 java.lang.Object readXml(java.io.File xmlFile, java.lang.Object root)
          read an XML file, construct and return the object hierarchy
 java.lang.Object readXml(java.io.InputStream xmlFile, java.lang.Object root)
          read an XML input stream, construct and return the object hierarchy
 void registerDTDFile(java.lang.String publicId, java.lang.String dtdFile)
          Register the specified DTD with a local file.
 void registerDTDRes(java.lang.String publicId, java.lang.String dtdRes)
          Register the specified DTD to map to a resource in the classpath This must be called prior to the first call to readXml().
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolve the requested external entity, replacing it by an internal DTD if one has been registered.
 void setDebug(int level)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 XmlAction setParent(java.lang.String childM)
          For the last 2 objects in stack, create a parent-child and child.childM with parente as parameter
 XmlAction setParent(java.lang.String childM, java.lang.String argType)
          For the last 2 objects in stack, create a parent-child and child.childM with parent as parameter
 XmlAction setProperties()
          Set object properties using XML attributes
 void setRoot(java.lang.Object o)
           
 void setValidating(boolean validating)
           
 void startDocument()
           
 void startElement(java.lang.String tag, org.xml.sax.AttributeList attributes)
           
 void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
           
 
クラス org.xml.sax.HandlerBase から継承したメソッド
fatalError, warning
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

XmlMapper

public XmlMapper()
メソッドの詳細

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
オーバーライド:
クラス org.xml.sax.HandlerBase 内の setDocumentLocator

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
オーバーライド:
クラス org.xml.sax.HandlerBase 内の startDocument

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
オーバーライド:
クラス org.xml.sax.HandlerBase 内の endDocument

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
オーバーライド:
クラス org.xml.sax.HandlerBase 内の error

startElement

public void startElement(java.lang.String tag,
                         org.xml.sax.AttributeList attributes)
                  throws org.xml.sax.SAXException
オーバーライド:
クラス org.xml.sax.HandlerBase 内の startElement

endElement

public void endElement(java.lang.String tag)
                throws org.xml.sax.SAXException
オーバーライド:
クラス org.xml.sax.HandlerBase 内の endElement

characters

public void characters(char[] buf,
                       int offset,
                       int len)
                throws org.xml.sax.SAXException
オーバーライド:
クラス org.xml.sax.HandlerBase 内の characters

ignorableWhitespace

public void ignorableWhitespace(char[] buf,
                                int offset,
                                int len)
                         throws org.xml.sax.SAXException
オーバーライド:
クラス org.xml.sax.HandlerBase 内の ignorableWhitespace

processingInstruction

public void processingInstruction(java.lang.String name,
                                  java.lang.String instruction)
                           throws org.xml.sax.SAXException
オーバーライド:
クラス org.xml.sax.HandlerBase 内の processingInstruction

getAttributeList

public org.xml.sax.AttributeList getAttributeList(int pos)
インタフェース SaxContext の記述:
Access attributes of a particular tag
定義:
インタフェース SaxContext 内の getAttributeList

getTagCount

public int getTagCount()
インタフェース SaxContext の記述:
Depth of the tag stack.
定義:
インタフェース SaxContext 内の getTagCount

getTag

public java.lang.String getTag(int pos)
インタフェース SaxContext の記述:
Access a particular tag
定義:
インタフェース SaxContext 内の getTag

getBody

public java.lang.String getBody()
インタフェース SaxContext の記述:
Body of the last tag
定義:
インタフェース SaxContext 内の getBody

getObjectStack

public java.util.Stack getObjectStack()
インタフェース SaxContext の記述:
We maintain a stack to keep java objects that are generated as result of parsing. You can either use the stack ( which is very powerfull construct !), or use the root object and navigation in the result tree.
定義:
インタフェース SaxContext 内の getObjectStack

getPublicId

public java.lang.String getPublicId()
定義:
インタフェース SaxContext 内の getPublicId

getRoot

public java.lang.Object getRoot()
インタフェース SaxContext の記述:
The root object is either set by caller before starting the parse or can be created using the first tag. It is used to set object in the result graph by navigation ( using root and a path). Please use the stack, it's much faster and better.
定義:
インタフェース SaxContext 内の getRoot

setRoot

public void setRoot(java.lang.Object o)

setDebug

public void setDebug(int level)

getDebug

public int getDebug()
定義:
インタフェース SaxContext 内の getDebug

setValidating

public void setValidating(boolean validating)

getValidating

public boolean getValidating()

log

public void log(java.lang.String msg)
定義:
インタフェース SaxContext 内の log

readXml

public java.lang.Object readXml(java.io.File xmlFile,
                                java.lang.Object root)
                         throws java.lang.Exception
read an XML file, construct and return the object hierarchy

readXml

public java.lang.Object readXml(java.io.InputStream xmlFile,
                                java.lang.Object root)
                         throws java.lang.Exception
read an XML input stream, construct and return the object hierarchy

registerDTDFile

public void registerDTDFile(java.lang.String publicId,
                            java.lang.String dtdFile)
Register the specified DTD with a local file. This must be called prior to the first call to readXml().
パラメータ:
publicId - Public identifier of the DTD to be resolved
dtdFile - The local file name to use for reading this DTD

registerDTDRes

public void registerDTDRes(java.lang.String publicId,
                           java.lang.String dtdRes)
Register the specified DTD to map to a resource in the classpath This must be called prior to the first call to readXml().
パラメータ:
publicId - Public identifier of the DTD to be resolved
dtdRes - local resource name, to be used with getResource()

addRule

public void addRule(java.lang.String path,
                    XmlAction action)

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, replacing it by an internal DTD if one has been registered.
オーバーライド:
クラス org.xml.sax.HandlerBase 内の resolveEntity
パラメータ:
publicId - Public identifier of the entity being referenced
systemId - System identifier of the entity being referenced
例外:
org.xml.sax.SAXException - if a parsing error occurs

notationDecl

public void notationDecl(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
オーバーライド:
クラス org.xml.sax.HandlerBase 内の notationDecl

unparsedEntityDecl

public void unparsedEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String notationName)
オーバーライド:
クラス org.xml.sax.HandlerBase 内の unparsedEntityDecl

objectCreate

public XmlAction objectCreate(java.lang.String classN)
Create an object using for a matching tag with the given class name

objectCreate

public XmlAction objectCreate(java.lang.String classN,
                              java.lang.String attrib)
Create an object using an attribute value as the class name If no attribute use classN as a default.

setProperties

public XmlAction setProperties()
Set object properties using XML attributes

setParent

public XmlAction setParent(java.lang.String childM)
For the last 2 objects in stack, create a parent-child and child.childM with parente as parameter

setParent

public XmlAction setParent(java.lang.String childM,
                           java.lang.String argType)
For the last 2 objects in stack, create a parent-child and child.childM with parent as parameter

addChild

public XmlAction addChild(java.lang.String parentM,
                          java.lang.String argType)
For the last 2 objects in stack, create a parent-child relation by invokeing parent.parentM with the child as parameter ArgType is the parameter expected by addParent ( null use the current object type)

methodSetter

public XmlAction methodSetter(java.lang.String method,
                              int paramC)
If a tag matches, invoke a method on the current object. Parameters can be extracted from sub-elements of the current tag.

methodSetter

public XmlAction methodSetter(java.lang.String method,
                              int paramC,
                              java.lang.String[] paramTypes)
If a tag matches, invoke a method on the current object. Parameters can be extracted from sub-elements of the current tag.

methodParam

public XmlAction methodParam(int ord)
Extract the method param from the body of the tag

methodParam

public XmlAction methodParam(int ord,
                             java.lang.String attrib)
Extract the method param from a tag attribute

popStack

public XmlAction popStack()
Pop the object stack


Copyright ? 2000-2001 Apache Software Foundation. All Rights Reserved.