Interface XMQElement

All Superinterfaces:
XMQNode

public interface XMQElement extends 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 Details

    • ns

      XMQNS ns()
      Returns the namespace this element belongs to.
      Returns:
      The namespace or null.
    • setNs

      void setNs(XMQNS ns)
      Set the namespace this element belongs to.
      Parameters:
      ns - The namespace or null.
    • declareNs

      XMQNS declareNs(String prefix, String uri)
      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

      XMQNS searchNs(String prefix)
      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

      XMQAttr attribute(String name)
      Returns the attribute with a given name.
      Parameters:
      name - The name without prefix.
      Returns:
      The attribute or null.
    • attributeByFullName

      XMQAttr attributeByFullName(String name)
      Returns the attribute with a given full name, ie including the prefix.
      Parameters:
      name - The full name.
      Returns:
      The attribute or null.
    • setAttribute

      XMQAttr setAttribute(String name, String value)
      Set an attribute on the element. If an attribute with the same name already exists, its value is updated.
      Parameters:
      name - The name without prefix.
      value - The value.
      Returns:
      The attribute.
    • addAttribute

      XMQAttr addAttribute(XMQAttr a)
      Add an attribute to the element.
      Parameters:
      a - The attribute (without an element).
      Returns:
      The attribute.
    • removeAttribute

      void removeAttribute(XMQAttr a)
      Remove an attribute by object identity.
      Parameters:
      a - The attribute.
    • attributeValue

      String attributeValue(String name)
      Returns the value of the attribute with a given name.
      Parameters:
      name - The name without prefix.
      Returns:
      The value or null.
    • elements

      List<XMQElement> elements()
      Returns a new list with all element children of this element.
      Returns:
      The elements, an empty list if none.
    • element

      XMQElement element(String name)
      Returns the child element with a given name, without looking into nested elements.
      Parameters:
      name - The name without prefix.
      Returns:
      The element or null.