Class XPathNamespaceNode
java.lang.Object
org.libxmq.imp.xml.XmlNode
org.libxmq.imp.xml.XPathNamespaceNode
- All Implemented Interfaces:
XMQNode
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 Summary
ConstructorsConstructorDescriptionXPathNamespaceNode(XmlElement element, String prefix, String uri, int index) Create a namespace node. -
Method Summary
Modifier and TypeMethodDescriptioncontent()Returns the text content of text like nodes (text, cdata, comment, pi).element()Returns the element owning this namespace node.booleanfullName()Returns the full name, ie prefix:name if the node has a namespace with a prefix.inthashCode()intindex()Returns the position of this node on the namespace axis of its element.prefix()Returns the prefix of the namespace, null for the default namespace.Returns the string value of the node, like libxml2 xmlNodeGetContent.type()Returns the type of this node.uri()Returns the namespace uri.Methods inherited from class XmlNode
addChild, addNextSibling, addPrevSibling, appendRaw, children, doc, firstChild, hasChildren, lastChild, line, name, next, numChildren, parent, prev, replaceWith, setContent, setLine, setName, toString, unlinkModifier and TypeMethodDescriptionAdd a child like libxml2 xmlAddChild.Insert a sibling after this node, like libxml2 xmlAddNextSibling (but without text merging).Insert a sibling before this node, like libxml2 xmlAddPrevSibling (but without text merging).Append a child without merging adjacent text nodes.children()Returns a new list with the children of this node.doc()Returns the document owning this node.Returns the first child.booleanReturns true if this node has children.Returns the last child.intline()Returns the source line of the node, like libxml2 xmlGetLineNo: elements get the line where their start tag ends, text the line where its first chunk was read, comments, processing instructions and cdata sections the line where they end.name()Returns the name of the node.next()Returns the next sibling.intCount the children.parent()Returns the parent node.prev()Returns the previous sibling.voidReplace this node with another node, like libxml2 xmlReplaceNode.voidsetContent(String content) Set the content of a text like node.voidsetLine(int line) Set the source line of the node.voidSet the name of the node.toString()voidunlink()Remove this node from its parent and siblings, like libxml2 xmlUnlinkNode.
-
Constructor Details
-
XPathNamespaceNode
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
-
prefix
Returns the prefix of the namespace, null for the default namespace.- Returns:
- The prefix.
-
uri
-
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
Description copied from class:XmlNodeReturns the text content of text like nodes (text, cdata, comment, pi). Returns null for other nodes, useXmlNode.textContent()for the concatenated text of an element. -
textContent
Description copied from class:XmlNodeReturns 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:
textContentin interfaceXMQNode- Overrides:
textContentin classXmlNode- Returns:
- The text content, never null.
-
fullName
-
equals
-
hashCode
-