Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.ibatis.common.xml
Class NodeletParser  view NodeletParser download NodeletParser.java

java.lang.Object
  extended bycom.ibatis.common.xml.NodeletParser

public class NodeletParser
extends java.lang.Object

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.


Nested Class Summary
private static class NodeletParser.Path
          Inner helper class that assists with building XPath paths.
 
Field Summary
private  org.xml.sax.EntityResolver entityResolver
           
private  java.util.Map letMap
           
private  boolean validation
           
 
Constructor Summary
NodeletParser()
           
 
Method Summary
 void addNodelet(java.lang.String xpath, Nodelet nodelet)
          Registers a nodelet for the specified XPath.
private  org.w3c.dom.Document createDocument(java.io.Reader reader)
          Creates a JAXP Document from a reader.
 void parse(org.w3c.dom.Node node)
          Begins parsing from the provided Node.
 void parse(java.io.Reader reader)
          Begins parsing from the provided Reader.
private  void process(org.w3c.dom.Node node, NodeletParser.Path path)
          A recursive method that walkes the DOM tree, registers XPaths and calls Nodelets registered under those XPaths.
private  void processNodelet(org.w3c.dom.Node node, java.lang.String pathString)
           
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
           
 void setValidation(boolean validation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

letMap

private java.util.Map letMap

validation

private boolean validation

entityResolver

private org.xml.sax.EntityResolver entityResolver
Constructor Detail

NodeletParser

public NodeletParser()
Method Detail

addNodelet

public void addNodelet(java.lang.String xpath,
                       Nodelet nodelet)
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


parse

public void parse(java.io.Reader reader)
           throws NodeletException
Begins parsing from the provided Reader.


parse

public void parse(org.w3c.dom.Node node)
Begins parsing from the provided Node.


process

private void process(org.w3c.dom.Node node,
                     NodeletParser.Path path)
A recursive method that walkes the DOM tree, registers XPaths and calls Nodelets registered under those XPaths.


processNodelet

private void processNodelet(org.w3c.dom.Node node,
                            java.lang.String pathString)

createDocument

private org.w3c.dom.Document createDocument(java.io.Reader reader)
                                     throws javax.xml.parsers.ParserConfigurationException,
                                            javax.xml.parsers.FactoryConfigurationError,
                                            org.xml.sax.SAXException,
                                            java.io.IOException
Creates a JAXP Document from a reader.


setValidation

public void setValidation(boolean validation)

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)