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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNodelet(String xpath, Nodelet nodelet) Registers a nodelet for the specified XPath.voidparse(InputStream inputStream) Parses the.voidBegins parsing from the provided Reader.voidBegins parsing from the provided Node.voidsetEntityResolver(EntityResolver resolver) Sets the entity resolver.voidsetValidation(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
-
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
-