Class XPathNamespaceNode

java.lang.Object
org.libxmq.imp.xml.XmlNode
org.libxmq.imp.xml.XPathNamespaceNode
All Implemented Interfaces:
XMQNode

public final class XPathNamespaceNode extends XmlNode
A namespace node, created when the xpath namespace axis is traversed. Like libxml2 (which copies the xmlNs and points its next field to the owning element), a new namespace node is created for every traversal. Two namespace nodes are equal if they belong to the same element and have the same prefix, which is how libxml2 deduplicates them when merging node sets. The semantics are ported from libxml2 xpath.c (Copyright (C) 1998-2012 Daniel Veillard, MIT license).
  • Constructor Details

    • XPathNamespaceNode

      public XPathNamespaceNode(XmlElement element, String prefix, String uri, int index)
      Create a namespace node.
      Parameters:
      element - The element owning the namespace node, becomes the parent.
      prefix - The prefix or null for the default namespace.
      uri - The namespace uri.
      index - The position of this node on the namespace axis of the element.
  • Method Details

    • type

      public XMQNodeType type()
      Description copied from class: XmlNode
      Returns the type of this node.
      Specified by:
      type in interface XMQNode
      Specified by:
      type in class XmlNode
      Returns:
      The node type.
    • prefix

      public String prefix()
      Returns the prefix of the namespace, null for the default namespace.
      Returns:
      The prefix.
    • uri

      public String uri()
      Returns the namespace uri.
      Returns:
      The uri.
    • element

      public XmlElement element()
      Returns the element owning this namespace node.
      Returns:
      The element.
    • index

      public int index()
      Returns the position of this node on the namespace axis of its element.
      Returns:
      The index, the xml namespace has index 0.
    • content

      public String content()
      Description copied from class: XmlNode
      Returns the text content of text like nodes (text, cdata, comment, pi). Returns null for other nodes, use XmlNode.textContent() for the concatenated text of an element.
      Specified by:
      content in interface XMQNode
      Overrides:
      content in class XmlNode
      Returns:
      The content or null.
    • textContent

      public String textContent()
      Description copied from class: XmlNode
      Returns the string value of the node, like libxml2 xmlNodeGetContent. For an element this is the concatenation of all descendant text, where entity references contribute nothing (entities are never expanded implicitly) and character references kept as nodes their character.
      Specified by:
      textContent in interface XMQNode
      Overrides:
      textContent in class XmlNode
      Returns:
      The text content, never null.
    • fullName

      public String fullName()
      Description copied from class: XmlNode
      Returns the full name, ie prefix:name if the node has a namespace with a prefix.
      Specified by:
      fullName in interface XMQNode
      Overrides:
      fullName in class XmlNode
      Returns:
      The full name.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object