org.apache.xpath
Class DOM2Helper

java.lang.Object
  |
  +--org.apache.xpath.DOMHelper
        |
        +--org.apache.xpath.DOM2Helper
Direct Known Subclasses:
StreeDOMHelper

public class DOM2Helper
extends DOMHelper

Provides XSLTProcessor an interface to the Xerces XML parser. This liaison should be used if Xerces DOM nodes are being process as the source tree or as the result tree.

See Also:
org.apache.xalan.xslt.XSLTProcessor, org.apache.xml.parsers

Constructor Summary
DOM2Helper()
          Construct an instance.
 
Method Summary
 void checkNode(Node node)
          **For internal use only** Check node to see if it matches this liaison.
 Document getDocument()
           
 Element getElementByID(java.lang.String id, Document doc)
          Given an ID, return the element.
 java.lang.String getLocalNameOfNode(Node n)
          Returns the local name of the given node.
 java.lang.String getNamespaceOfNode(Node n)
          Returns the namespace of the given node.
 Node getParentOfNode(Node node)
          Get the parent of a node.
 boolean isNodeAfter(Node node1, Node node2)
          Figure out if node2 should be placed after node1 when placing nodes in a list that is to be sorted in document order.
 void parse(InputSource source)
          **For internal use only** Parse an XML document.
 void setDocument(Document doc)
           
 boolean supportsSAX()
          Returns true that this implementation does support the SAX ContentHandler interface.
 
Methods inherited from class org.apache.xpath.DOMHelper
createDocument, getDOMFactory, getExpandedAttributeName, getExpandedElementName, getLevel, getNamespaceForPrefix, getNodeData, getNodeData, getRoot, getRootNode, getUniqueID, getUnparsedEntityURI, isIgnorableWhitespace, isNamespaceNode, setDOMFactory, shouldStripSourceNode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOM2Helper

public DOM2Helper()
Construct an instance.
Method Detail

checkNode

public void checkNode(Node node)
               throws SAXException
**For internal use only** Check node to see if it matches this liaison.

supportsSAX

public boolean supportsSAX()
Returns true that this implementation does support the SAX ContentHandler interface.

setDocument

public void setDocument(Document doc)

getDocument

public Document getDocument()

parse

public void parse(InputSource source)
           throws SAXException
**For internal use only** Parse an XML document.

Right now the Xerces DOMParser class is used. This needs fixing, either via jaxp, or via some other, standard method.

The application can use this method to instruct the SAX parser to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).

Applications may not invoke this method while a parse is in progress (they should create a new Parser instead for each additional XML document). Once a parse is complete, an application may reuse the same Parser object, possibly with a different input source.

Parameters:
source - The input source for the top-level of the XML document.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
java.io.IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See Also:
InputSource, #parse(java.lang.String), #setEntityResolver, #setDTDHandler, #setContentHandler, #setErrorHandler

getElementByID

public Element getElementByID(java.lang.String id,
                              Document doc)
Given an ID, return the element.
Overrides:
getElementByID in class DOMHelper

isNodeAfter

public boolean isNodeAfter(Node node1,
                           Node node2)
Figure out if node2 should be placed after node1 when placing nodes in a list that is to be sorted in document order. NOTE: Make sure this does the right thing with attribute nodes!!!
Returns:
true if node2 should be placed after node1, and false if node2 should be placed before node1.
Overrides:
isNodeAfter in class DOMHelper

getParentOfNode

public Node getParentOfNode(Node node)
                     throws java.lang.RuntimeException
Get the parent of a node.
Overrides:
getParentOfNode in class DOMHelper

getLocalNameOfNode

public java.lang.String getLocalNameOfNode(Node n)
Returns the local name of the given node.
Overrides:
getLocalNameOfNode in class DOMHelper

getNamespaceOfNode

public java.lang.String getNamespaceOfNode(Node n)
Returns the namespace of the given node.
Overrides:
getNamespaceOfNode in class DOMHelper


Copyright © 2000 Apache XML Project. All Rights Reserved.