XCC/J 4.0-9

com.marklogic.xcc.types
Interface XdmElement

All Superinterfaces:
XdmItem, XdmNode, XdmValue

public interface XdmElement
extends XdmNode

An XQuery value which is an element().


Method Summary
 Document asW3cDocument()
          This is equivalent to asW3cDocument (null).
 Document asW3cDocument(DocumentBuilder docBuilder)
           Returns a W3C Document object with this element() as the root node.
 Element asW3cElement()
          This is equivalent to asW3cElement (null).
 Element asW3cElement(DocumentBuilder docBuilder)
           Returns a W3C Element object equivalent to this XdmElement.
 
Methods inherited from interface com.marklogic.xcc.types.XdmNode
asW3cNode, asW3cNode
 
Methods inherited from interface com.marklogic.xcc.types.XdmItem
asInputStream, asReader, getItemType, isCached, writeTo, writeTo
 
Methods inherited from interface com.marklogic.xcc.types.XdmValue
asString, getValueType
 

Method Detail

asW3cElement

Element asW3cElement(DocumentBuilder docBuilder)
                     throws IOException,
                            SAXException

Returns a W3C Element object equivalent to this XdmElement. Buffers the element() item from the server and converts it to a W3C Element DOM object. The element() is buffered as a String object. Subsequent calls will create a new DOM tree from the same String. The buffered String may also be used by XdmValue.asString() and XdmItem.asInputStream().

Parameters:
docBuilder - The javax.xml.parsers.DocumentBuilder object to use to construct the Document. If null, the default implementation will be used. See the JDK documentation for the javax.xml.parsers.DocumentBuilderFactory class for details on configuring the system default builder.
Returns:
This item as a W3C element (org.w3c.dom.Element) instance.
Throws:
IllegalStateException - If called after the InputStream has already been consumed.
IOException
SAXException
See Also:
XdmItem.asInputStream(), XdmValue.asString(), XdmItem.isCached(), XdmNode.asW3cNode()

asW3cElement

Element asW3cElement()
                     throws ParserConfigurationException,
                            IOException,
                            SAXException
This is equivalent to asW3cElement (null).

Returns:
This item as a W3C element (org.w3c.dom.Element) instance.
Throws:
ParserConfigurationException
IOException
SAXException

asW3cDocument

Document asW3cDocument(DocumentBuilder docBuilder)
                       throws IOException,
                              SAXException

Returns a W3C Document object with this element() as the root node. Buffers the element() item from the server and converts it to a W3C Element DOM object. The element() is buffered as a String object. Subsequent calls will create a new DOM tree from the same String. The buffered String may also be used by XdmValue.asString() and XdmItem.asInputStream().

If you are using JDOM and want to create a JDOM Document for this node, do the following: doc = new org.jdom.input.SAXBuilder().build (new StringReader (node.asString()))

Parameters:
docBuilder - The javax.xml.parsers.DocumentBuilder object to use to construct the Document. If null, the default implementation will be used. See the JDK documentation for the javax.xml.parsers.DocumentBuilderFactory class for details on configuring the system default builder.
Returns:
This item as a W3C document (org.w3c.dom.Document) instance.
Throws:
IllegalStateException - If called after the InputStream has already been consumed.
IOException
SAXException
See Also:
XdmItem.asInputStream(), XdmValue.asString(), XdmItem.isCached(), XdmNode.asW3cNode()

asW3cDocument

Document asW3cDocument()
                       throws ParserConfigurationException,
                              IOException,
                              SAXException
This is equivalent to asW3cDocument (null).

Returns:
This item as a W3C document (org.w3c.dom.Document) instance.
Throws:
ParserConfigurationException
IOException
SAXException

XCC/J 4.0-9

Copyright © 2003-2010 Mark Logic Corporation, All Rights Reserved.

Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com