Class NamespaceItem

java.lang.Object
org.rumbledb.items.xml.NamespaceItem
All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable, Serializable, Item

public class NamespaceItem extends Object implements Item
See Also:
  • Constructor Details

    • NamespaceItem

      public NamespaceItem()
    • NamespaceItem

      public NamespaceItem(String prefix, String uri)
      Constructor for a namespace item.
      Parameters:
      prefix - The namespace prefix (possibly empty)
      uri - The namespace URI
  • Method Details

    • setXmlDocumentPosition

      public int setXmlDocumentPosition(String path, int current)
      Each Namespace Node represents the binding of a namespace URI to a namespace prefix or to the default namespace. Namespaces have the following properties: prefix , possibly empty uri parent , possibly empty A Namespace Node must not have the name xmlns nor the string-value http://www.w3.org/2000/xmlns/ .
      Specified by:
      setXmlDocumentPosition in interface Item
      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
      Specified by:
      getXmlDocumentPosition in interface Item
      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.
      Specified by:
      addParentToDescendants in interface Item
    • write

      public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
      Specified by:
      write in interface com.esotericsoftware.kryo.KryoSerializable
    • read

      public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input)
      Specified by:
      read in interface com.esotericsoftware.kryo.KryoSerializable
    • isNode

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

      public boolean isNamespaceNode()
      Description copied from interface: Item
      Tests whether the item is an XML Namespace node.
      Specified by:
      isNamespaceNode in interface Item
      Returns:
      true if it is an XML Namespace node, false otherwise.
    • nodeName

      public Name nodeName()
      Description copied from interface: Item
      XDM 3.1 Section 5.10 node-name Accessor. dm:node-name($n as node()) as xs:QName? "The dm:node-name accessor returns the name of the node as an xs:QName, or the empty sequence if the node does not have a name."
      Specified by:
      nodeName in interface Item
      Returns:
      the expanded name (Name) of the node, or null when the accessor yields the empty sequence
    • getPrefix

      public String getPrefix()
      Returns the namespace prefix (possibly empty).
    • getUri

      public String getUri()
      Returns the namespace URI.
    • 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."
      Specified by:
      parent in interface Item
    • getStringValue

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

      public void setParent(Item parent)
      Specified by:
      setParent in interface Item
    • getDynamicType

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

      public String nodeKind()
      XDM 3.1 Section 6.4 Namespace Node Accessors — node-kind. "For a Namespace Node, dm:node-kind returns the string \"namespace\"."
      Specified by:
      nodeKind in interface Item
    • equals

      public boolean equals(Object other)
      Description copied from interface: Item
      Tests for logical equality. The semantics are that of the eq operator.
      Specified by:
      equals in interface Item
      Overrides:
      equals in class Object
      Parameters:
      other - another item.
      Returns:
      true it is equal to other, false otherwise.
    • hashCode

      public int hashCode()
      Description copied from interface: Item
      Computes a hash code.
      Specified by:
      hashCode in interface Item
      Overrides:
      hashCode in class Object
      Returns:
      a hash code as an int.
    • 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().
      Specified by:
      atomizedValue in interface Item
    • 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.
      Specified by:
      namespaceNodes in interface Item
    • 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.
      Specified by:
      declaredNamespaceNodes in interface Item
    • attributes

      public List<Item> attributes()
      XDM 3.1 Section 6.4 Namespace Node Accessors — attributes. For a Namespace Node, dm:attributes returns the empty sequence.
      Specified by:
      attributes in interface Item
    • children

      public List<Item> children()
      XDM 3.1 Section 6.4 Namespace Node Accessors — children. For a Namespace Node, dm:children returns the empty sequence.
      Specified by:
      children in interface Item
    • baseUri

      public List<Item> baseUri()
      XDM 3.1 Section 6.4 Namespace Node Accessors — base-uri. For a Namespace Node, dm:base-uri returns the base URI of the parent node, if it has one; otherwise it returns the empty sequence.
      Specified by:
      baseUri in interface Item
    • documentUri

      public List<Item> documentUri()
      XDM 3.1 Section 6.4 Namespace Node Accessors — document-uri. For a Namespace Node, dm:document-uri returns the document-uri of the document node that is the root of the tree containing the namespace node, if it has one; otherwise it returns the empty sequence.
      Specified by:
      documentUri in interface Item
    • isId

      public boolean isId()
      XDM 3.1 Section 6.4 Namespace Node Accessors — is-id. For a Namespace Node, dm:is-id returns false.
      Specified by:
      isId in interface Item
    • isIdrefs

      public boolean isIdrefs()
      XDM 3.1 Section 6.4 Namespace Node Accessors — is-idrefs. For a Namespace Node, dm:is-idrefs returns false.
      Specified by:
      isIdrefs in interface Item
    • nilled

      public List<Item> nilled()
      XDM 3.1 Section 6.4 Namespace Node Accessors — nilled. For a Namespace Node, dm:nilled returns the empty sequence.
      Specified by:
      nilled in interface Item
    • typeName

      public List<Item> typeName()
      XDM 3.1 Section 6.4 Namespace Node Accessors — type-name. For a Namespace Node, dm:type-name returns the empty sequence.
      Specified by:
      typeName in interface Item