Class DocumentItem

java.lang.Object
org.rumbledb.items.xml.AbstractNodeItem
org.rumbledb.items.xml.DocumentItem
All Implemented Interfaces:
Serializable, Item

public class DocumentItem extends AbstractNodeItem
See Also:
  • Constructor Details

    • DocumentItem

      public DocumentItem(Node documentNode, List<Item> children)
    • DocumentItem

      public DocumentItem(List<Item> children)
      Constructor for creating a document node with children items. Used by document node constructors when no actual DOM node is available.
      Parameters:
      children - the child nodes of the document
  • Method Details

    • copy

      public Item copy(boolean mutable)
      Description copied from interface: Item
      Makes a copy.
      Parameters:
      mutable - whether the copy should be mutable (if supported by the item).
      Returns:
      a copy
    • setXmlDocumentPosition

      public int setXmlDocumentPosition(String path, int current)
      Description copied from interface: Item
      Set the position of the Node inside the XML document (and path incase of multiple docs) for sorting / uniqueness
      Parameters:
      path - the path of the XML document
      current - the current position
      Returns:
      the new position
    • getXmlDocumentPosition

      public XMLDocumentPosition getXmlDocumentPosition()
      Description copied from interface: Item
      Get the position of the Node inside the XML document (and path incase of multiple docs) for sorting / uniqueness
      Returns:
      the XML document position
    • addParentToDescendants

      public void addParentToDescendants()
      Description copied from interface: Item
      Method sets the parent item for all descendents of the current item.
    • children

      public List<Item> children()
      Description copied from interface: Item
      XDM 3.1 Section 5.3 children Accessor. dm:children($n as node()) as node()* "The dm:children accessor returns the dynamic, ordered sequence of child nodes of the node. It is defined on all node kinds except attribute and namespace nodes; for those node kinds it returns the empty sequence."
    • parent

      public Item parent()
      Description copied from interface: Item
      XDM 3.1 Section 5.11 parent Accessor. dm:parent($n as node()) as node()? "The dm:parent accessor returns the parent of the node, or the empty sequence if the node has no parent."
    • getStringValue

      public String getStringValue()
      Description copied from interface: Item
      Returns the string value of the item, if it is an atomic item.
      Returns:
      the string value.
    • getDynamicType

      public ItemType getDynamicType()
      Description copied from interface: Item
      Returns the dynamic type of the item (only for error message purposes).
      Returns:
      the dynamic type as an item type.
    • isNode

      public boolean isNode()
      Description copied from interface: Item
      Tests whether the item is an XML node.
      Returns:
      true if it is an XML node, false otherwise.
    • isDocumentNode

      public boolean isDocumentNode()
      Description copied from interface: Item
      Tests whether the item is an XML Document node.
      Returns:
      true if it is an XML Document node, false otherwise.
    • nodeKind

      public String nodeKind()
      XDM 3.1 Section 6.1 Document Node Accessors — node-kind. "For a Document Node, dm:node-kind returns the string \"document\"."
    • nodeName

      public Name nodeName()
      XDM 3.1 Section 6.1 Document Node Accessors — node-name. "For a Document Node, dm:node-name returns the empty sequence."
      Returns:
      the expanded name (Name) of the node, or null when the accessor yields the empty sequence
    • attributes

      public List<Item> attributes()
      XDM 3.1 Section 6.1 Document Node Accessors — attributes. "For a Document Node, dm:attributes returns the empty sequence."
    • baseUri

      public List<Item> baseUri()
      XDM 3.1 Section 6.1 Document Node Accessors — base-uri. "For a Document Node, dm:base-uri returns the base URI of the document node, if it has one; otherwise it returns the empty sequence."
    • documentUri

      public List<Item> documentUri()
      XDM 3.1 Section 6.1 Document Node Accessors — document-uri. "For a Document Node, dm:document-uri returns the document-uri property of the document node, if it has one; otherwise it returns the empty sequence." RumbleDB does not currently track document URIs, so this implementation returns null to represent the empty sequence.
    • isId

      public boolean isId()
      XDM 3.1 Section 6.1 Document Node Accessors — is-id. For a Document Node, dm:is-id returns false.
    • isIdrefs

      public boolean isIdrefs()
      XDM 3.1 Section 6.1 Document Node Accessors — is-idrefs. For a Document Node, dm:is-idrefs returns false.
    • nilled

      public List<Item> nilled()
      XDM 3.1 Section 6.1 Document Node Accessors — nilled. For a Document Node, dm:nilled returns the empty sequence.
    • typeName

      public List<Item> typeName()
      XDM 3.1 Section 6.1 Document Node Accessors — type-name. For a Document Node, dm:type-name returns the empty sequence.
    • typedValue

      public List<Item> typedValue()
      XDM 3.1 Section 6.1 Document Node Accessors — typed-value. For a Document Node, dm:typed-value returns the typed value of the document node as a sequence of zero or more atomic values. This implementation delegates to atomizedValue().
    • unparsedEntityPublicId

      public List<Item> unparsedEntityPublicId(String name)
      XDM 3.1 Section 6.1 Document Node Accessors — unparsed-entity-public-id. For a Document Node, dm:unparsed-entity-public-id returns the public identifier of an unparsed entity with a given name in the document, or the empty sequence if there is no such entity or if it has no public identifier. RumbleDB does not currently support unparsed entities, so this implementation always returns the empty sequence.
    • unparsedEntitySystemId

      public List<Item> unparsedEntitySystemId(String name)
      XDM 3.1 Section 6.1 Document Node Accessors — unparsed-entity-system-id. For a Document Node, dm:unparsed-entity-system-id returns the system identifier of an unparsed entity with a given name in the document, or the empty sequence if there is no such entity or if it has no system identifier. RumbleDB does not currently support unparsed entities, so this implementation always returns the empty sequence.
    • atomizedValue

      public List<Item> atomizedValue()
      Description copied from interface: Item
      XDM 3.1 Section 5.12 string-value Accessor. dm:string-value($n as node()) as xs:string "The dm:string-value accessor returns the string-value of the node as defined for each node kind." In this API, node string values are exposed via getStringValue() and the default implementation of dm:typed-value delegates to atomizedValue().
    • namespaceNodes

      public List<Item> namespaceNodes()
      Description copied from interface: Item
      XDM 3.1 Section 5.7 namespace-nodes Accessor. dm:namespace-nodes($n as node()) as namespace-node()* "The dm:namespace-nodes accessor returns the dynamic, unordered set of Namespace Nodes. It is defined on all seven node kinds." This default implementation is only a placeholder on the generic Item interface and must be overridden by XML node implementations that support namespaces.
    • declaredNamespaceNodes

      public List<Item> declaredNamespaceNodes()
      Description copied from interface: Item
      Helper accessor for XML element nodes: returns namespace nodes for the namespace bindings declared directly on the element. This does not include inherited or statically known namespaces — only the bindings explicitly declared on the element (for example via xmlns attributes). Non-element nodes must override this to return the empty sequence.