org.apache.xml.utils
public class DOM2Helper extends DOMHelper
Deprecated: Since the introduction of the DTM, this class will be removed. 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)
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(String id, Document doc)
Given an XML ID, return the element. |
String | getLocalNameOfNode(Node n)
Returns the local name of the given node, as defined by the
XML Namespaces specification. |
String | getNamespaceOfNode(Node n)
Returns the Namespace Name (Namespace URI) for the given node.
|
static Node | getParentOfNode(Node node)
Get the XPath-model parent of a node. |
static 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)
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.
|
Parameters: node The node to be tested.
Throws: TransformerException if the node is not one which this DOM2Helper can support. If we return without throwing the exception, the node is compatable.
UNKNOWN: internal
Returns: The DOM Document node for this document.
See Also: DOM2Helper
Parameters: id The ID to search for, as a String. doc The document to search within, as a DOM Document node.
Returns: DOM Element node with an attribute of type ID whose value uniquely matches the requested id string, or null if there isn't such an element or if the DOM can't answer the question for other reasons.
Parameters: n Node to be examined
Returns: String containing the local name, or null if the node was not assigned a Namespace.
TODO: Reconcile with getLocalNameOfNode.
Parameters: n Node to be examined
Returns: String containing the Namespace URI bound to this DOM node at the time the Node was created.
Parameters: node Node to be examined
Returns: the DOM parent of the input node, if there is one, or the ownerElement if the input node is an Attr, or null if the node is a Document, a DocumentFragment, or an orphan.
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!!!
Parameters: node1 DOM Node to perform position comparison on. node2 DOM Node to perform position comparison on .
Returns: false if node2 comes before node1, otherwise return true.
You can think of this as
(node1.documentOrderPosition <= node2.documentOrderPosition)
.
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: TransformerException if any checked exception is thrown.
UNKNOWN: internal
Parameters: doc The DOM Document node for this document.
See Also: DOM2Helper
Returns: true (since Xerces does).