|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.HandlerBase | +--org.apache.catalina.util.xml.XmlMapper
SAX Handler - it will read the XML and construct java objects
Constructor Summary | |
XmlMapper()
|
Method Summary | |
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)
|
Methods inherited from class org.xml.sax.HandlerBase |
fatalError, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XmlMapper()
Method Detail |
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.DocumentHandler
setDocumentLocator
in class org.xml.sax.HandlerBase
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.DocumentHandler
startDocument
in class org.xml.sax.HandlerBase
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.DocumentHandler
endDocument
in class org.xml.sax.HandlerBase
org.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.HandlerBase
org.xml.sax.SAXException
public void startElement(java.lang.String tag, org.xml.sax.AttributeList attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.DocumentHandler
startElement
in class org.xml.sax.HandlerBase
org.xml.sax.SAXException
public void endElement(java.lang.String tag) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.DocumentHandler
endElement
in class org.xml.sax.HandlerBase
org.xml.sax.SAXException
public void characters(char[] buf, int offset, int len) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.DocumentHandler
characters
in class org.xml.sax.HandlerBase
org.xml.sax.SAXException
public void ignorableWhitespace(char[] buf, int offset, int len) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.DocumentHandler
ignorableWhitespace
in class org.xml.sax.HandlerBase
org.xml.sax.SAXException
public void processingInstruction(java.lang.String name, java.lang.String instruction) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.DocumentHandler
processingInstruction
in class org.xml.sax.HandlerBase
org.xml.sax.SAXException
public org.xml.sax.AttributeList getAttributeList(int pos)
SaxContext
getAttributeList
in interface SaxContext
public int getTagCount()
SaxContext
getTagCount
in interface SaxContext
public java.lang.String getTag(int pos)
SaxContext
getTag
in interface SaxContext
public java.lang.String getBody()
SaxContext
getBody
in interface SaxContext
public java.util.Stack getObjectStack()
SaxContext
getObjectStack
in interface SaxContext
public java.lang.String getPublicId()
getPublicId
in interface SaxContext
public java.lang.Object getRoot()
SaxContext
getRoot
in interface SaxContext
public void setRoot(java.lang.Object o)
public void setDebug(int level)
public int getDebug()
getDebug
in interface SaxContext
public void setValidating(boolean validating)
public boolean getValidating()
public void log(java.lang.String msg)
log
in interface SaxContext
public java.lang.Object readXml(java.io.File xmlFile, java.lang.Object root) throws java.lang.Exception
java.lang.Exception
public java.lang.Object readXml(java.io.InputStream xmlFile, java.lang.Object root) throws java.lang.Exception
java.lang.Exception
public void registerDTDFile(java.lang.String publicId, java.lang.String dtdFile)
readXml()
.
publicId
- Public identifier of the DTD to be resolveddtdFile
- The local file name to use for reading this DTDpublic void registerDTDRes(java.lang.String publicId, java.lang.String dtdRes)
readXml()
.
publicId
- Public identifier of the DTD to be resolveddtdRes
- local resource name, to be used with getResource()public void addRule(java.lang.String path, XmlAction action)
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
resolveEntity
in interface org.xml.sax.EntityResolver
resolveEntity
in class org.xml.sax.HandlerBase
publicId
- Public identifier of the entity being referencedsystemId
- System identifier of the entity being referenced
org.xml.sax.SAXException
- if a parsing error occurspublic void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
notationDecl
in interface org.xml.sax.DTDHandler
notationDecl
in class org.xml.sax.HandlerBase
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
unparsedEntityDecl
in interface org.xml.sax.DTDHandler
unparsedEntityDecl
in class org.xml.sax.HandlerBase
public XmlAction objectCreate(java.lang.String classN)
public XmlAction objectCreate(java.lang.String classN, java.lang.String attrib)
public XmlAction setProperties()
public XmlAction setParent(java.lang.String childM)
public XmlAction setParent(java.lang.String childM, java.lang.String argType)
public XmlAction addChild(java.lang.String parentM, java.lang.String argType)
public XmlAction methodSetter(java.lang.String method, int paramC)
public XmlAction methodSetter(java.lang.String method, int paramC, java.lang.String[] paramTypes)
public XmlAction methodParam(int ord)
public XmlAction methodParam(int ord, java.lang.String attrib)
public XmlAction popStack()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |