public abstract class AbstractXmlReadHandler extends Object implements XmlReadHandler
XmlReadHandler
. This class
takes care of all the delegation management.Modifier | Constructor and Description |
---|---|
protected |
AbstractXmlReadHandler()
Creates a new handler.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
This method is called to process the character data between element tags.
|
protected Map |
deriveParseParameters()
Creates a working copy of the current parse state.
|
protected void |
doneParsing()
Done parsing.
|
void |
endElement(String uri,
String tagName)
This method is called at the end of an element.
|
protected XmlReadHandler |
getHandlerForChild(String uri,
String tagName,
Attributes atts)
Returns the handler for a child element.
|
Locator |
getLocator()
Returns the locator as provided by the XML parser.
|
RootXmlReadHandler |
getRootHandler()
Returns the root handler for the parsing.
|
String |
getTagName()
Returns the tag name.
|
String |
getUri()
Returns the uri of the element.
|
void |
init(RootXmlReadHandler rootHandler,
String uri,
String tagName)
Initialises the handler.
|
protected boolean |
isSameNamespace(String namespaceURI)
Checks whether the given url denotes the same namespace as the element's namespace.
|
protected Object |
performExternalParsing(String file,
Class targetClass)
Parses an external file using LibLoader and returns the parsed result as an object of type
targetClass . |
protected Object |
performExternalParsing(String file,
Class targetClass,
Map map)
Parses an external file using LibLoader and returns the parsed result as an object of type
targetClass . |
void |
startElement(String uri,
String tagName,
Attributes attrs)
This method is called at the start of an element.
|
protected void |
startParsing(Attributes attrs)
Starts parsing.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getObject
public void init(RootXmlReadHandler rootHandler, String uri, String tagName) throws SAXException
init
in interface XmlReadHandler
rootHandler
- the root handler.tagName
- the tag name.uri
- the namespace uri.SAXException
- if an parser-error occured.public final void startElement(String uri, String tagName, Attributes attrs) throws SAXException
startElement
in interface XmlReadHandler
tagName
- the tag name.attrs
- the attributes.uri
- the namespace uri.SAXException
- if there is a parsing error.public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface XmlReadHandler
ch
- the character buffer.start
- the start index.length
- the length.SAXException
- if there is a parsing error.public final void endElement(String uri, String tagName) throws SAXException
endElement
in interface XmlReadHandler
tagName
- the tag name.uri
- the namespace uri.SAXException
- if there is a parsing error.protected void startParsing(Attributes attrs) throws SAXException
attrs
- the attributes.SAXException
- if there is a parsing error.protected void doneParsing() throws SAXException
SAXException
- if there is a parsing error.protected boolean isSameNamespace(String namespaceURI)
namespaceURI
- the namespace that should be tested.protected XmlReadHandler getHandlerForChild(String uri, String tagName, Attributes atts) throws SAXException
uri
- the URI of the namespace of the current element.tagName
- the tag name.atts
- the attributes.SAXException
- if there is a parsing error.public String getTagName()
public String getUri()
public RootXmlReadHandler getRootHandler()
public Locator getLocator()
protected Object performExternalParsing(String file, Class targetClass) throws ParseException, ResourceLoadingException
targetClass
. The file is given as relative pathname (relative to the current source file). The current
helper-methods are used as parse-parameters for the external parsing.file
- the file to be parsed.targetClass
- the target type of the parse operation.ParseException
- if parsing the result failed for some reason.ResourceLoadingException
- if there was an IO error loading the resource.deriveParseParameters()
,
performExternalParsing(String, Class, Map)
protected Object performExternalParsing(String file, Class targetClass, Map map) throws ParseException, ResourceLoadingException
targetClass
. The file is given as relative pathname (relative to the current source file). The current
helper-methods are used as parse-parameters for the external parsing.file
- the file to be parsed.targetClass
- the target type of the parse operation.map
- the map of parse parameters.ParseException
- if parsing the result failed for some reason.ResourceLoadingException
- if there was an IO error loading the resource.deriveParseParameters()
protected Map deriveParseParameters()
Copyright © 2002–2017 Pentaho Corporation. All rights reserved.