Package com.ibatis.common.xml
Class NodeletParser
java.lang.Object
com.ibatis.common.xml.NodeletParser
The NodeletParser is a callback based parser similar to SAX. The big difference is that rather than having a single
callback for all nodes, the NodeletParser has a number of callbacks mapped to various nodes. The callback is called a
Nodelet and it is registered with the NodeletParser against a specific XPath.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNodelet
(String xpath, Nodelet nodelet) Registers a nodelet for the specified XPath.void
parse
(InputStream inputStream) Parses the.void
Begins parsing from the provided Reader.void
Begins parsing from the provided Node.void
setEntityResolver
(EntityResolver resolver) Sets the entity resolver.void
setValidation
(boolean validation) Sets the validation.
-
Constructor Details
-
NodeletParser
public NodeletParser()
-
-
Method Details
-
addNodelet
Registers a nodelet for the specified XPath. Current XPaths supported are:- Text Path - /rootElement/childElement/text()
- Attribute Path - /rootElement/childElement/@theAttribute
- Element Path - /rootElement/childElement/theElement
- All Elements Named - //theElement
- Parameters:
xpath
- the xpathnodelet
- the nodelet
-
parse
Begins parsing from the provided Reader.- Parameters:
reader
- the reader- Throws:
NodeletException
- the nodelet exception
-
parse
Parses the.- Parameters:
inputStream
- the input stream- Throws:
NodeletException
- the nodelet exception
-
parse
Begins parsing from the provided Node.- Parameters:
node
- the node
-
setValidation
public void setValidation(boolean validation) Sets the validation.- Parameters:
validation
- the new validation
-
setEntityResolver
Sets the entity resolver.- Parameters:
resolver
- the new entity resolver
-