Class NodeletParser

java.lang.Object
com.ibatis.common.xml.NodeletParser

public class NodeletParser extends 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.
  • Constructor Details

    • NodeletParser

      public NodeletParser()
  • Method Details

    • addNodelet

      public void addNodelet(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
      Parameters:
      xpath - the xpath
      nodelet - the nodelet
    • parse

      public void parse(Reader reader) throws NodeletException
      Begins parsing from the provided Reader.
      Parameters:
      reader - the reader
      Throws:
      NodeletException - the nodelet exception
    • parse

      public void parse(InputStream inputStream) throws NodeletException
      Parses the.
      Parameters:
      inputStream - the input stream
      Throws:
      NodeletException - the nodelet exception
    • parse

      public void parse(Node node)
      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

      public void setEntityResolver(EntityResolver resolver)
      Sets the entity resolver.
      Parameters:
      resolver - the new entity resolver