Interface XmlElement

    • Method Detail

      • getBaseUri

        String getBaseUri()
        XML Infoset [base URI] property
        Returns:
        a String
      • setBaseUri

        void setBaseUri​(String baseUri)
        XML Infoset [base URI] property
        Parameters:
        baseUri - a String
      • getRoot

        XmlContainer getRoot()
        Get top most container that is either XmlDocument or XmlElement (may be event this element!!!)
      • getParent

        XmlContainer getParent()
        XML Infoset [parent] property. If current element is not child of containing parent XmlElement or XmlDocument then builder exception will be thrown
        Specified by:
        getParent in interface XmlContained
      • getNamespace

        XmlNamespace getNamespace()
        Return namespace of current element (XML Infoset [namespace name] and [prefix] properties combined) null is only returned if element was created without namespace
      • getNamespaceName

        String getNamespaceName()
        Return namespace name (XML Infoset [namespace name]property or null if element has no namespace
      • setNamespace

        void setNamespace​(XmlNamespace namespace)
        Set namespace ot use for theis element. Note: namespace prefix is always ignored.
      • getName

        String getName()
        XML Infoset [local name] property.
        Returns:
        a String
      • setName

        void setName​(String name)
        XML Infoset [local name] property.
        Parameters:
        name - a String
      • attributes

        Iterator attributes()
        Return Iterator - null is never returned if there is no children then iteraotr over empty collection is returned
      • addAttribute

        XmlAttribute addAttribute​(XmlAttribute attributeValueToAdd)
        Add attribute (adds it to the XML Infoset [namespace attributes] set) Attribute mist
        Parameters:
        attributeValueToAdd - a XmlAttribute
        Returns:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(String name,
                                  String value)
        addAttribute
        Parameters:
        name - a String
        value - a String
        Returns:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(XmlNamespace namespace,
                                  String name,
                                  String value)
        Method addAttribute
        Parameters:
        namespace - a XmlNamespace
        name - a String
        value - a String
        Returns:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(String type,
                                  XmlNamespace namespace,
                                  String name,
                                  String value)
        Method addAttribute
        Parameters:
        type - a String
        namespace - a XmlNamespace
        name - a String
        value - a String
        Returns:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(String type,
                                  XmlNamespace namespace,
                                  String name,
                                  String value,
                                  boolean specified)
        Method addAttribute
        Parameters:
        type - a String
        namespace - a XmlNamespace
        name - a String
        value - a String
        specified - a boolean
        Returns:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(String attributeType,
                                  String attributePrefix,
                                  String attributeNamespace,
                                  String attributeName,
                                  String attributeValue,
                                  boolean specified)
        Method addAttribute
        Parameters:
        attributeType - a String
        attributePrefix - a String
        attributeNamespace - a String
        attributeName - a String
        attributeValue - a String
        specified - a boolean
        Returns:
        a XmlAttribute
      • ensureAttributeCapacity

        void ensureAttributeCapacity​(int minCapacity)
        Method ensureAttributeCapacity
        Parameters:
        minCapacity - an int
      • getAttributeValue

        String getAttributeValue​(String attributeNamespaceName,
                                 String attributeName)
        Method getAttributeValue
        Parameters:
        attributeNamespaceNamea - String
        attributeName - a String
        Returns:
        a String
      • attribute

        XmlAttribute attribute​(String attributeName)
        Find attribute that matches given name or namespace Returns null if not found. Will match only attribute that have no namesapce.
      • attribute

        XmlAttribute attribute​(XmlNamespace attributeNamespaceName,
                               String attributeName)
        Find attribute that matches given name or namespace Returns null if not found. NOTE: if namespace is null in this case it will match only attributes that have no namespace.
      • findAttribute

        XmlAttribute findAttribute​(String attributeNamespaceName,
                                   String attributeName)
        Deprecated.
        Use attribute()
        Find attribute that matches given name or namespace Returns null if not found. NOTE: if namespace is null in this case it will match only attributes that has no namespace.
      • hasAttributes

        boolean hasAttributes()
        Method hasAttributes
        Returns:
        a boolean
      • removeAttribute

        void removeAttribute​(XmlAttribute attr)
        Method removeAttribute
        Parameters:
        attr - a XmlAttribute
      • removeAllAttributes

        void removeAllAttributes()
        Method removeAllAttributes
      • namespaces

        Iterator namespaces()
        Return Iterator - null is never returned if there is no children then iteraotr over empty collection is returned
      • declareNamespace

        XmlNamespace declareNamespace​(String prefix,
                                      String namespaceName)
        Create new namespace with prefix and namespace name (both must be not null) and add it to current element.
      • declareNamespace

        XmlNamespace declareNamespace​(XmlNamespace namespace)
        Add namespace to current element (both prefix and namespace name must be not null)
      • ensureNamespaceDeclarationsCapacity

        void ensureNamespaceDeclarationsCapacity​(int minCapacity)
        Method ensureNamespaceDeclarationsCapacity
        Parameters:
        minCapacity - an int
      • hasNamespaceDeclarations

        boolean hasNamespaceDeclarations()
        Method hasNamespaceDeclarations
        Returns:
        a boolean
      • lookupNamespaceByPrefix

        XmlNamespace lookupNamespaceByPrefix​(String namespacePrefix)
        Find namespace (will have non empty prefix) corresponding to namespace prefix checking first current elemen and if not found continue in parent (if element has parent) and so on.
      • lookupNamespaceByName

        XmlNamespace lookupNamespaceByName​(String namespaceName)
        Find namespace (will have non empty prefix) corresponding to namespace name checking first current elemen and if not found continue in parent (if element has parent). and so on.
      • newNamespace

        XmlNamespace newNamespace​(String namespaceName)
        Create new namespace with null prefix (namespace name must be not null).
      • newNamespace

        XmlNamespace newNamespace​(String prefix,
                                  String namespaceName)
        Create new namespace with prefix and namespace name (both must be not null).
      • removeAllNamespaceDeclarations

        void removeAllNamespaceDeclarations()
        Method removeAllNamespaceDeclarations
      • children

        Iterator children()
        Return Iterator - null is never returned if there is no children then iteraotr over empty collection is returned
        • addChild

          void addChild​(Object child)
          NOTE: =child added is _not_ checked if it XmlContainer, caller must manually fix parent in child by calling setParent() !!!!
        • addChild

          void addChild​(int pos,
                        Object child)
          Method addChild
          Parameters:
          pos - an int (starting from 0)
          child - an Object
        • addElement

          XmlElement addElement​(XmlElement el)
          NOTE: the child element must unattached to be added (it is atttached if it is XmlContainer of recognized type and getParent() != null)
        • addElement

          XmlElement addElement​(int pos,
                                XmlElement child)
          Method addElement
          Parameters:
          pos - an int (starting from 0)
          child - a XmlElement
          Returns:
          a XmlElement
        • addElement

          XmlElement addElement​(String name)
          Method addElement
          Parameters:
          name - a String
          Returns:
          a XmlElement
        • addElement

          XmlElement addElement​(XmlNamespace namespace,
                                String name)
          Method addElement
          Parameters:
          namespace - a XmlNamespace
          name - a String
          Returns:
          a XmlElement
        • hasChildren

          boolean hasChildren()
          Method hasChildren
          Returns:
          a boolean
        • hasChild

          boolean hasChild​(Object child)
          Method hasChild
          Parameters:
          child - an Object
          Returns:
          a boolean
        • ensureChildrenCapacity

          void ensureChildrenCapacity​(int minCapacity)
          Method ensureChildrenCapacity
          Parameters:
          minCapacity - an int
        • findElementByName

          XmlElement findElementByName​(String name)
          Deprecated.
          see element()
        • findElementByName

          XmlElement findElementByName​(String namespaceName,
                                       String name)
          Deprecated.
          see element()
        • element

          XmlElement element​(int position)
          return element at poition (0..count-1) or IndexOutOfBoundsException if positon incorrect
        • element

          XmlElement element​(XmlNamespace n,
                             String name)
          find first element with name and namespace (if namespace is null it is ignored in search)
        • element

          XmlElement element​(XmlNamespace n,
                             String name,
                             boolean create)
          find first element with name and namespace (if namespace is null it is ignored in search) if no matching element is found then new element is created, appended to children, and returned
        • elements

          Iterable elements​(XmlNamespace n,
                            String name)
          Return all elements that has namespace and name (null is never returned but empty iteraotr)
        • insertChild

          void insertChild​(int pos,
                           Object childToInsert)
        • newElement

          XmlElement newElement​(XmlNamespace namespace,
                                String name)
          Method newElement
          Parameters:
          namespace - a XmlNamespace
          name - a String
          Returns:
          a XmlElement
        • newElement

          XmlElement newElement​(String namespaceName,
                                String name)
          Method newElement
          Parameters:
          namespaceName - a String
          name - a String
          Returns:
          a XmlElement
        • removeAllChildren

          void removeAllChildren()
          Removes all children - every child that was implementing XmlNode will have set parent to null.
        • removeChild

          void removeChild​(Object child)
          Method removeChild
          Parameters:
          child - an Object
        • replaceChild

          void replaceChild​(Object newChild,
                            Object oldChild)
          Method replaceChild
          Parameters:
          newChild - an Object
          oldChild - an Object
        • requiredElementContent

          Iterable requiredElementContent()
          Return Iterator - that represents all XmlElement content. When used exception will be thrown if non white space children are found (as expected no mixed content!).
        • requiredTextContent

          String requiredTextContent()
          return children content as text - if there are any no text children throw exception
        • replaceChildrenWithText

          void replaceChildrenWithText​(String textContent)
          Remove all children and then add this text as only child.