Package com.aspectran.utils.nodelet
Class NodeletParser
java.lang.Object
com.aspectran.utils.nodelet.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 TypeMethodDescriptionvoid
addEndNodelet
(EndNodelet nodelet) Registers the nodelet to process the end elements of the specified XPath and the text and CDATA data collected.void
addNodelet
(Nodelet nodelet) Registers a nodelet to process attributes for the specified XPath.void
addNodelet
(SubnodeParser subnodeParser) Adds the nodelet.void
addNodelet
(String xpath, SubnodeParser subnodeParser) Add nodelets through the subnode parser.void
Clear object stack.<N> N
getXpath()
void
parse
(InputStream inputStream) Begins parsing from the provided InputStream.void
Begins parsing from the provided Reader.void
parse
(InputSource inputSource) Begins parsing from the provided InputSource.<T> T
<T> T
peekObject
(int n) <T> T
peekObject
(Class<?> target) <T> T
void
pushObject
(Object object) void
setEntityResolver
(EntityResolver entityResolver) void
setValidating
(boolean validating) void
-
Constructor Details
-
NodeletParser
-
-
Method Details
-
getNodeParser
public <N> N getNodeParser() -
setValidating
public void setValidating(boolean validating) -
setEntityResolver
-
trackingLocation
-
getNodeTracker
-
getXpath
-
setXpath
-
addNodelet
Registers a nodelet to process attributes for the specified XPath. It supports the following XPaths:- Element Path - /rootElement/childElement/theElement
- Parameters:
nodelet
- the nodelet for processing start elements and attributes
-
addEndNodelet
Registers the nodelet to process the end elements of the specified XPath and the text and CDATA data collected.- Parameters:
nodelet
- the nodelet for processing end elements, text and CDATA data collected
-
addNodelet
Adds the nodelet.- Parameters:
subnodeParser
- the subnode parser
-
addNodelet
Add nodelets through the subnode parser.- Parameters:
xpath
- the xpathsubnodeParser
- the subnode parser
-
pushObject
-
popObject
public <T> T popObject() -
peekObject
public <T> T peekObject() -
peekObject
public <T> T peekObject(int n) -
peekObject
-
clearObjectStack
public void clearObjectStack()Clear object stack. -
parse
Begins parsing from the provided Reader.- Parameters:
reader
- the reader- Throws:
NodeletException
- the nodelet exception
-
parse
Begins parsing from the provided InputStream.- Parameters:
inputStream
- the input stream- Throws:
NodeletException
- the nodelet exception
-
parse
Begins parsing from the provided InputSource.- Parameters:
inputSource
- the input source- Throws:
NodeletException
- the nodelet exception
-