public abstract class RootXmlReadHandler extends FrontendDefaultHandler
Modifier and Type | Field and Description |
---|---|
private SimpleObjectFactory |
classToHandlerMapping
Maps classes to handlers.
|
private java.util.Stack |
currentHandlers
The current handlers.
|
private java.util.HashMap |
objectRegistry
The object registry.
|
private java.util.Stack |
outerScopes
??.
|
private XmlReadHandler |
rootHandler
The root handler.
|
private boolean |
rootHandlerInitialized |
CONTENTBASE_KEY
Constructor and Description |
---|
RootXmlReadHandler()
Creates a new root SAX handler.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDefaultMappings()
Adds the default mappings.
|
protected void |
addManualMapping(java.lang.Class classToRead,
java.lang.Class handler)
Adds a mapping between a class and the handler for the class.
|
protected void |
addMultiplexMapping(java.lang.Class baseClass,
java.lang.String typeAttr,
MultiplexMappingEntry[] mdef)
Adds a multiplex mapping.
|
void |
characters(char[] ch,
int start,
int length)
Process character data.
|
XmlReadHandler |
createHandler(java.lang.Class classToRead,
java.lang.String tagName,
org.xml.sax.Attributes atts)
Creates a SAX handler for the specified class.
|
void |
delegate(XmlReadHandler handler,
java.lang.String tagName,
org.xml.sax.Attributes attrs)
Delegate to another handler.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Finish processing an element.
|
private XmlReadHandler |
findHandlerForClass(java.lang.Class classToRead,
org.xml.sax.Attributes atts,
java.util.ArrayList history)
Finds a handler for the specified class.
|
protected XmlReadHandler |
getCurrentHandler()
Returns the current handler.
|
abstract ObjectFactory |
getFactoryLoader()
Returns the object factory.
|
java.lang.Object |
getHelperObject(java.lang.String key)
Returns an object from the registry.
|
java.lang.Object |
getResult()
Returns ???.
|
protected XmlReadHandler |
getRootHandler()
Returns the root SAX handler.
|
protected java.lang.Class |
loadClass(java.lang.String className)
Loads the given class, and ignores all exceptions which may occur
during the loading.
|
protected XmlReadHandler |
loadHandlerClass(java.lang.String className)
Loads the given class, and ignores all exceptions which may occur
during the loading.
|
void |
recurse(XmlReadHandler handler,
java.lang.String tagName,
org.xml.sax.Attributes attrs)
Start a new handler stack and delegate to another handler.
|
void |
setHelperObject(java.lang.String key,
java.lang.Object value)
Adds an object to the registry.
|
protected void |
setRootHandler(XmlReadHandler handler)
Sets the root SAX handler.
|
void |
startDocument()
Starts processing a document.
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
Starts processing an element.
|
void |
unwind(java.lang.String tagName)
Hand control back to the previous handler.
|
clone, findPropertyKeys, getCommentHandler, getConfigProperties, getConfigProperty, getConfigProperty, getContentBase, getLocator, newInstance, setConfigProperty, setDocumentLocator
private java.util.Stack currentHandlers
private java.util.Stack outerScopes
private XmlReadHandler rootHandler
private java.util.HashMap objectRegistry
private SimpleObjectFactory classToHandlerMapping
private boolean rootHandlerInitialized
protected void addDefaultMappings()
public abstract ObjectFactory getFactoryLoader()
protected void addManualMapping(java.lang.Class classToRead, java.lang.Class handler)
classToRead
- the class.handler
- the handler class.protected void addMultiplexMapping(java.lang.Class baseClass, java.lang.String typeAttr, MultiplexMappingEntry[] mdef)
baseClass
- the base class.typeAttr
- the type attribute.mdef
- the mapping entry.public void setHelperObject(java.lang.String key, java.lang.Object value)
key
- the key.value
- the object.public java.lang.Object getHelperObject(java.lang.String key)
key
- the key.public XmlReadHandler createHandler(java.lang.Class classToRead, java.lang.String tagName, org.xml.sax.Attributes atts) throws XmlReaderException
classToRead
- the class.tagName
- the tag name.atts
- the attributes.XmlReaderException
- if there is a problem with the reader.private XmlReadHandler findHandlerForClass(java.lang.Class classToRead, org.xml.sax.Attributes atts, java.util.ArrayList history) throws XmlReaderException
classToRead
- the class to be read.atts
- the attributes.history
- the history.XmlReaderException
- if there is a problem with the reader.protected void setRootHandler(XmlReadHandler handler)
handler
- the SAX handler.protected XmlReadHandler getRootHandler()
public void recurse(XmlReadHandler handler, java.lang.String tagName, org.xml.sax.Attributes attrs) throws XmlReaderException, org.xml.sax.SAXException
handler
- the handler.tagName
- the tag name.attrs
- the attributes.XmlReaderException
- if there is a problem with the reader.org.xml.sax.SAXException
- if there is a problem with the parser.public void delegate(XmlReadHandler handler, java.lang.String tagName, org.xml.sax.Attributes attrs) throws XmlReaderException, org.xml.sax.SAXException
handler
- the new handler.tagName
- the tag name.attrs
- the attributes.XmlReaderException
- if there is a problem with the reader.org.xml.sax.SAXException
- if there is a problem with the parser.public void unwind(java.lang.String tagName) throws org.xml.sax.SAXException, XmlReaderException
tagName
- the tagname.org.xml.sax.SAXException
- if there is a problem with the parser.XmlReaderException
- if there is a problem with the reader.protected XmlReadHandler getCurrentHandler()
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- not in this implementation.public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
uri
- the URI.localName
- the local name.qName
- the qName.attributes
- the attributes.org.xml.sax.SAXException
- if there is a parsing problem.public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
ch
- the character buffer.start
- the start index.length
- the length of the character data.org.xml.sax.SAXException
- if there is a parsing error.public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
uri
- the URI.localName
- the local name.qName
- the qName.org.xml.sax.SAXException
- if there is a parsing error.protected XmlReadHandler loadHandlerClass(java.lang.String className) throws XmlReaderException
className
- the name of the class to be loaded.XmlReaderException
- if there is a reader error.protected java.lang.Class loadClass(java.lang.String className) throws XmlReaderException
className
- the name of the class to be loaded.XmlReaderException
- if there is a reader error.public java.lang.Object getResult() throws org.xml.sax.SAXException
getResult
in class FrontendDefaultHandler
org.xml.sax.SAXException
- ???.