com.marklogic.xcc.types

## Interface XdmNode

- All Superinterfaces:
    XdmItem, XdmValue
  All Known Subinterfaces:
    ArrayNode, BooleanNode, NullNode, NumberNode, ObjectNode, XdmAttribute, XdmBinary, XdmComment, XdmDocument, XdmElement, XdmProcessingInstruction, XdmText

      public interface XdmNode
      extends XdmItem

  An XDM value which is a node().

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.w3c.dom.Node` | `asW3cNode()` This is equivalent to `asW3cNode (null);`
    `org.w3c.dom.Node` | `asW3cNode(javax.xml.parsers.DocumentBuilder docBuilder)` Buffers the node() item from the server and converts it to a W3C DOM Node object.

    - ### 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

    - #### asW3cNode

          org.w3c.dom.Node asW3cNode(javax.xml.parsers.DocumentBuilder docBuilder)
                              throws java.io.IOException,
                                     org.xml.sax.SAXException

      Buffers the node() item from the server and converts it to a W3C DOM Node object. The node() is first buffered as a String object. Subsequent calls will create a new DOM tree from the buffered String. The buffered String will also be used by subsequent calls to asString() and 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 Node. 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 node (org.w3c.dom.Node) instance.
      Throws:
        `java.lang.IllegalStateException` - If called after the InputStream has already been consumed.
        `java.io.IOException`
        `org.xml.sax.SAXException`
      See Also:
        `XdmItem.asInputStream()`, `XdmValue.asString()`, `XdmItem.isCached()`

    - #### asW3cNode

          org.w3c.dom.Node asW3cNode()
                              throws javax.xml.parsers.ParserConfigurationException,
                                     java.io.IOException,
                                     org.xml.sax.SAXException

      This is equivalent to `asW3cNode (null);`
      Returns:
        This item as a W3C node (org.w3c.dom.Node) instance.
      Throws:
        `javax.xml.parsers.ParserConfigurationException`
        `java.io.IOException`
        `org.xml.sax.SAXException`
      See Also:
        `asW3cNode(javax.xml.parsers.DocumentBuilder)`

Copyright © 2025 MarkLogic Corporation. All Rights Reserved.

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