Package org.jfree.xml.parser
Class RootXmlReadHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.jfree.xml.FrontendDefaultHandler
-
- org.jfree.xml.parser.RootXmlReadHandler
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,Configuration,org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler
public abstract class RootXmlReadHandler extends FrontendDefaultHandler
A base root SAX handler.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.jfree.xml.FrontendDefaultHandler
CONTENTBASE_KEY
-
-
Constructor Summary
Constructors Constructor Description RootXmlReadHandler()Creates a new root SAX handler.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddDefaultMappings()Adds the default mappings.protected voidaddManualMapping(java.lang.Class classToRead, java.lang.Class handler)Adds a mapping between a class and the handler for the class.protected voidaddMultiplexMapping(java.lang.Class baseClass, java.lang.String typeAttr, MultiplexMappingEntry[] mdef)Adds a multiplex mapping.voidcharacters(char[] ch, int start, int length)Process character data.XmlReadHandlercreateHandler(java.lang.Class classToRead, java.lang.String tagName, org.xml.sax.Attributes atts)Creates a SAX handler for the specified class.voiddelegate(XmlReadHandler handler, java.lang.String tagName, org.xml.sax.Attributes attrs)Delegate to another handler.voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)Finish processing an element.protected XmlReadHandlergetCurrentHandler()Returns the current handler.abstract ObjectFactorygetFactoryLoader()Returns the object factory.java.lang.ObjectgetHelperObject(java.lang.String key)Returns an object from the registry.java.lang.ObjectgetResult()Returns ???.protected XmlReadHandlergetRootHandler()Returns the root SAX handler.protected java.lang.ClassloadClass(java.lang.String className)Loads the given class, and ignores all exceptions which may occur during the loading.protected XmlReadHandlerloadHandlerClass(java.lang.String className)Loads the given class, and ignores all exceptions which may occur during the loading.voidrecurse(XmlReadHandler handler, java.lang.String tagName, org.xml.sax.Attributes attrs)Start a new handler stack and delegate to another handler.voidsetHelperObject(java.lang.String key, java.lang.Object value)Adds an object to the registry.protected voidsetRootHandler(XmlReadHandler handler)Sets the root SAX handler.voidstartDocument()Starts processing a document.voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)Starts processing an element.voidunwind(java.lang.String tagName)Hand control back to the previous handler.-
Methods inherited from class org.jfree.xml.FrontendDefaultHandler
clone, findPropertyKeys, getCommentHandler, getConfigProperties, getConfigProperty, getConfigProperty, getContentBase, getLocator, newInstance, setConfigProperty, setDocumentLocator
-
-
-
-
Constructor Detail
-
RootXmlReadHandler
public RootXmlReadHandler()
Creates a new root SAX handler.
-
-
Method Detail
-
addDefaultMappings
protected void addDefaultMappings()
Adds the default mappings.
-
getFactoryLoader
public abstract ObjectFactory getFactoryLoader()
Returns the object factory.- Returns:
- The object factory.
-
addManualMapping
protected void addManualMapping(java.lang.Class classToRead, java.lang.Class handler)
Adds a mapping between a class and the handler for the class.- Parameters:
classToRead- the class.handler- the handler class.
-
addMultiplexMapping
protected void addMultiplexMapping(java.lang.Class baseClass, java.lang.String typeAttr, MultiplexMappingEntry[] mdef)
Adds a multiplex mapping.- Parameters:
baseClass- the base class.typeAttr- the type attribute.mdef- the mapping entry.
-
setHelperObject
public void setHelperObject(java.lang.String key, java.lang.Object value)
Adds an object to the registry.- Parameters:
key- the key.value- the object.
-
getHelperObject
public java.lang.Object getHelperObject(java.lang.String key)
Returns an object from the registry.- Parameters:
key- the key.- Returns:
- The object.
-
createHandler
public XmlReadHandler createHandler(java.lang.Class classToRead, java.lang.String tagName, org.xml.sax.Attributes atts) throws XmlReaderException
Creates a SAX handler for the specified class.- Parameters:
classToRead- the class.tagName- the tag name.atts- the attributes.- Returns:
- a SAX handler.
- Throws:
XmlReaderException- if there is a problem with the reader.
-
setRootHandler
protected void setRootHandler(XmlReadHandler handler)
Sets the root SAX handler.- Parameters:
handler- the SAX handler.
-
getRootHandler
protected XmlReadHandler getRootHandler()
Returns the root SAX handler.- Returns:
- the root SAX handler.
-
recurse
public void recurse(XmlReadHandler handler, java.lang.String tagName, org.xml.sax.Attributes attrs) throws XmlReaderException, org.xml.sax.SAXException
Start a new handler stack and delegate to another handler.- Parameters:
handler- the handler.tagName- the tag name.attrs- the attributes.- Throws:
XmlReaderException- if there is a problem with the reader.org.xml.sax.SAXException- if there is a problem with the parser.
-
delegate
public void delegate(XmlReadHandler handler, java.lang.String tagName, org.xml.sax.Attributes attrs) throws XmlReaderException, org.xml.sax.SAXException
Delegate to another handler.- Parameters:
handler- the new handler.tagName- the tag name.attrs- the attributes.- Throws:
XmlReaderException- if there is a problem with the reader.org.xml.sax.SAXException- if there is a problem with the parser.
-
unwind
public void unwind(java.lang.String tagName) throws org.xml.sax.SAXException, XmlReaderException
Hand control back to the previous handler.- Parameters:
tagName- the tagname.- Throws:
org.xml.sax.SAXException- if there is a problem with the parser.XmlReaderException- if there is a problem with the reader.
-
getCurrentHandler
protected XmlReadHandler getCurrentHandler()
Returns the current handler.- Returns:
- The current handler.
-
startDocument
public void startDocument() throws org.xml.sax.SAXException
Starts processing a document.- Specified by:
startDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
startDocumentin classorg.xml.sax.helpers.DefaultHandler- Throws:
org.xml.sax.SAXException- not in this implementation.
-
startElement
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
Starts processing an element.- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classorg.xml.sax.helpers.DefaultHandler- Parameters:
uri- the URI.localName- the local name.qName- the qName.attributes- the attributes.- Throws:
org.xml.sax.SAXException- if there is a parsing problem.
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
Process character data.- Specified by:
charactersin interfaceorg.xml.sax.ContentHandler- Overrides:
charactersin classorg.xml.sax.helpers.DefaultHandler- Parameters:
ch- the character buffer.start- the start index.length- the length of the character data.- Throws:
org.xml.sax.SAXException- if there is a parsing error.
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
Finish processing an element.- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classorg.xml.sax.helpers.DefaultHandler- Parameters:
uri- the URI.localName- the local name.qName- the qName.- Throws:
org.xml.sax.SAXException- if there is a parsing error.
-
loadHandlerClass
protected XmlReadHandler loadHandlerClass(java.lang.String className) throws XmlReaderException
Loads the given class, and ignores all exceptions which may occur during the loading. If the class was invalid, null is returned instead.- Parameters:
className- the name of the class to be loaded.- Returns:
- the class or null.
- Throws:
XmlReaderException- if there is a reader error.
-
loadClass
protected java.lang.Class loadClass(java.lang.String className) throws XmlReaderException
Loads the given class, and ignores all exceptions which may occur during the loading. If the class was invalid, null is returned instead.- Parameters:
className- the name of the class to be loaded.- Returns:
- the class or null.
- Throws:
XmlReaderException- if there is a reader error.
-
getResult
public java.lang.Object getResult() throws org.xml.sax.SAXException
Returns ???.- Specified by:
getResultin classFrontendDefaultHandler- Returns:
- ???.
- Throws:
org.xml.sax.SAXException- ???.
-
-