Interface XMQElement
- All Superinterfaces:
XMQNode
An xml element, like xmqElementType. Its name may be prefixed, its
namespace is found (or not) by searchNs, its attributes are kept in source
order, and the namespace declarations (xmlns and xmlns:prefix) are kept
separately from the attributes.
-
Method Summary
Modifier and TypeMethodDescriptionAdd an attribute to the element.Returns the attribute with a given name.attributeByFullName(String name) Returns the attribute with a given full name, ie including the prefix.attributeValue(String name) Returns the value of the attribute with a given name.Declare a namespace on this element.Returns the child element with a given name, without looking into nested elements.elements()Returns a new list with all element children of this element.ns()Returns the namespace this element belongs to.voidRemove an attribute by object identity.Find the namespace declaration for the element itself or a given prefix, walking up to the root if needed, as in libxslt.setAttribute(String name, String value) Set an attribute on the element.voidSet the namespace this element belongs to.Methods inherited from interface XMQNode
addChild, addNextSibling, addPrevSibling, appendRaw, children, content, doc, firstChild, fullName, lastChild, line, name, next, numChildren, parent, prev, replaceWith, setContent, setLine, setName, textContent, type, unlinkModifier and TypeMethodDescriptionAdd a child like xmqAddChild.Insert a sibling after this node, like xmqAddNextSibling (but without text merging).Insert a sibling before this node, like xmqAddPrevSibling (but without text merging).Append a child without merging adjacent text nodes.children()Returns a new list with the children of this node.content()Returns the text content of text like nodes (text, cdata, comment, pi).doc()Returns the document owning this node.Returns the first child.fullName()Returns the full name, ie prefix:name if the node has a namespace with a prefix.Returns the last child.intline()Returns the source line of the node, like xmqGetLineNumber: 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.intReturns the number of children.parent()Returns the parent node.prev()Returns the previous sibling.voidReplace this node with another node, like xmqReplaceNode.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.Returns the string value of the node, like xmqGetString.type()Returns the type of this node.voidunlink()Remove this node from its parent and siblings, like xmqUnlinkNode.
-
Method Details
-
ns
-
setNs
Set the namespace this element belongs to.- Parameters:
ns- The namespace or null.
-
declareNs
Declare a namespace on this element. If the prefix is already declared on this element, the existing declaration is returned unchanged, also when its uri differs; compare its uri() to detect a conflict.- Parameters:
prefix- The prefix, null for the default namespace.uri- The namespace uri.- Returns:
- The new or the existing namespace declaration.
-
searchNs
Find the namespace declaration for the element itself or a given prefix, walking up to the root if needed, as in libxslt. A lookup of the empty prefix gives the default namespace.- Parameters:
prefix- The prefix to look up, or the empty string for the default namespace.- Returns:
- The namespace or null.
-
attribute
-
attributeByFullName
-
setAttribute
-
addAttribute
-
removeAttribute
Remove an attribute by object identity.- Parameters:
a- The attribute.
-
attributeValue
-
elements
List<XMQElement> elements()Returns a new list with all element children of this element.- Returns:
- The elements, an empty list if none.
-
element
Returns the child element with a given name, without looking into nested elements.- Parameters:
name- The name without prefix.- Returns:
- The element or null.
-