|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xpath.DOMHelper | +--org.apache.xpath.DOM2Helper
**For advanced use only** This class provides a DOM level 2 "helper", which provides services currently not provided be the DOM standard.
Constructor Summary | |
DOM2Helper()
Construct an instance. |
Method Summary | |
void |
checkNode(Node node)
**For internal use only** Check node to see if it was created by a DOM implementation that this helper is intended to support. |
Document |
getDocument()
Query which document this helper is currently operating on. |
Element |
getElementByID(java.lang.String id,
Document doc)
Given an XML ID, return the element. |
java.lang.String |
getLocalNameOfNode(Node n)
Returns the local name of the given node, as defined by the XML Namespaces specification. |
java.lang.String |
getNamespaceOfNode(Node n)
Returns the Namespace Name (Namespace URI) for the given node. |
Node |
getParentOfNode(Node node)
Get the XPath-model parent of a node. |
boolean |
isNodeAfter(Node node1,
Node node2)
Figure out whether node2 should be considered as being later in the document than node1, in Document Order as defined by the XPath model. |
void |
parse(InputSource source)
**For internal use only** Parse an XML document. |
void |
setDocument(Document doc)
Specify which document this helper is currently operating on. |
boolean |
supportsSAX()
Returns true if the DOM implementation handled by this helper supports 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 |
public DOM2Helper()
Method Detail |
public void checkNode(Node node) throws TransformerException
node
- The node to be tested.public boolean supportsSAX()
public void setDocument(Document doc)
doc
- The DOM Document node for this document.getDocument()
public Document getDocument()
setDocument(org.w3c.dom.Document)
public void parse(InputSource source) throws TransformerException
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.
source
- The input source for the top-level of the
XML document.public Element getElementByID(java.lang.String id, Document doc)
id
- The ID to search for, as a String.doc
- The document to search within, as a DOM Document node.public boolean isNodeAfter(Node node1, Node node2)
There are some cases where ordering isn't defined, and neither are the results of this function -- though we'll generally return true.
TODO: Make sure this does the right thing with attribute nodes!!!
node1
- DOM Node to perform position comparison on.node2
- DOM Node to perform position comparison on .(node1.documentOrderPosition <= node2.documentOrderPosition)
.public Node getParentOfNode(Node node)
node
- Node to be examinedpublic java.lang.String getLocalNameOfNode(Node n)
n
- Node to be examinedpublic java.lang.String getNamespaceOfNode(Node n)
TODO: Reconcile with getLocalNameOfNode.
n
- Node to be examined
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |