public class XDocument
extends java.lang.Object
Constructor and Description |
---|
XDocument()
XDocument constructor.
|
XDocument(org.w3c.dom.Document doc)
XDocument constructor.
|
XDocument(java.io.File file)
XDocument constructor.
|
XDocument(java.io.InputStream is)
XDocument constructor.
|
XDocument(org.w3c.dom.Node rootNode)
XDocument constructor.
|
XDocument(java.lang.String xmlString)
XDocument constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addNamespace(java.lang.String prefix,
java.lang.String namespaceUri)
Adds the given namespace definition to this documents XPathFactory, to use when evaluating XPaths.
|
org.w3c.dom.Document |
getDocument()
Returns the DOM Document contained by this object.
|
org.w3c.dom.Node |
getRootNode()
Return the top most node of this document.
|
org.w3c.dom.traversal.NodeIterator |
selectNodeIterator(java.lang.String xpath)
Evaluates the given xpath against this document and returns a matching NodeIterator.
|
org.w3c.dom.NodeList |
selectNodeList(java.lang.String xpath)
Evaluates the given xpath against this document and returns a matching NodeList.
|
org.w3c.dom.Node |
selectSingleNode(java.lang.String xpath)
Evaluates the given xpath against this document and returns the first matching Node.
|
java.lang.String |
selectString(java.lang.String xpath)
Evaluates the given xpath against this document and returns the result as a String.
|
void |
setDocument(org.w3c.dom.Document doc)
Sets the DOM document contained by this object to the given object.
|
void |
setNamespaces(java.util.Map namespaces)
Adds all the namespaces defined in the given map to this document's xpathfactory.
|
java.lang.String |
toString()
Produce a String representation for the XML Document.
|
XDocument |
transform(javax.xml.transform.Templates templates)
Utility method to transform the current document using a provided Templates object.
|
public XDocument()
public XDocument(org.w3c.dom.Document doc)
doc
- The org.w3c.dom.Document object to be wrapped by this classpublic XDocument(org.w3c.dom.Node rootNode)
rootNode
- The org.w3c.dom.Node object to be wrapped by this classpublic XDocument(java.lang.String xmlString)
xmlString
- String representation of the documentpublic XDocument(java.io.File file)
file
- the File location of the document to be parsedpublic XDocument(java.io.InputStream is)
is
- The InputStream to read from.public final org.w3c.dom.Document getDocument()
public final void setDocument(org.w3c.dom.Document doc)
doc
- the new DOM Document.public final org.w3c.dom.Node getRootNode()
public final void setNamespaces(java.util.Map namespaces)
namespaces
- A map of namespace prefixes to values/public final void addNamespace(java.lang.String prefix, java.lang.String namespaceUri)
prefix
- The prefix to use for this namespace.namespaceUri
- The actual value (namespaceURI) of this namespace.public final java.lang.String selectString(java.lang.String xpath)
xpath
- The xpath query to evaluate.public final org.w3c.dom.Node selectSingleNode(java.lang.String xpath)
xpath
- The xpath query to evaluate.public final org.w3c.dom.NodeList selectNodeList(java.lang.String xpath)
xpath
- The xpath query to evaluate.public final org.w3c.dom.traversal.NodeIterator selectNodeIterator(java.lang.String xpath)
xpath
- The xpath query to evaluate.public final java.lang.String toString()
toString
in class java.lang.Object
public final XDocument transform(javax.xml.transform.Templates templates)
templates
- The Templates object to use for the transformation.Copyright © 2007 Hyfinity Ltd. All Rights Reserved.