パッケージ org.xmlpull.v1.builder

インタフェース XmlElement

  • すべてのスーパーインタフェース:
    Cloneable, XmlContained, XmlContainer
    既知の実装クラスのリスト:
    XmlElementAdapter, XmlElementImpl

    public interface XmlElement
    extends XmlContainer, XmlContained, Cloneable
    Represents Element Information Item except for in-scope namespaces that can be reconstructed by visiting this element parent, checking its namespaces, then grandparent and so on. For convenience there are methods to resolve namespace prefix for given namespace name.
    NOTE: this representaiton is optimized for streaming - iterator approach that allows gradual visiting of nodes is preferred over indexed access.
    バージョン:
    $Revision: 1.25 $
    作成者:
    Aleksander Slominski
    • メソッドの詳細

      • getBaseUri

        String getBaseUri()
        XML Infoset [base URI] property
        戻り値:
        a String
      • setBaseUri

        void setBaseUri​(String baseUri)
        XML Infoset [base URI] property
        パラメータ:
        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
        定義:
        getParent インタフェース内 XmlContained
      • setParent

        void setParent​(XmlContainer parent)
        Method setParent
        定義:
        setParent インタフェース内 XmlContained
        パラメータ:
        parent - a XmlContainer
      • 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.
        戻り値:
        a String
      • setName

        void setName​(String name)
        XML Infoset [local name] property.
        パラメータ:
        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
        パラメータ:
        attributeValueToAdd - a XmlAttribute
        戻り値:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(String name,
                                  String value)
        addAttribute
        パラメータ:
        name - a String
        value - a String
        戻り値:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(XmlNamespace namespace,
                                  String name,
                                  String value)
        Method addAttribute
        パラメータ:
        namespace - a XmlNamespace
        name - a String
        value - a String
        戻り値:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(String type,
                                  XmlNamespace namespace,
                                  String name,
                                  String value)
        Method addAttribute
        パラメータ:
        type - a String
        namespace - a XmlNamespace
        name - a String
        value - a String
        戻り値:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(String type,
                                  XmlNamespace namespace,
                                  String name,
                                  String value,
                                  boolean specified)
        Method addAttribute
        パラメータ:
        type - a String
        namespace - a XmlNamespace
        name - a String
        value - a String
        specified - a boolean
        戻り値:
        a XmlAttribute
      • addAttribute

        XmlAttribute addAttribute​(String attributeType,
                                  String attributePrefix,
                                  String attributeNamespace,
                                  String attributeName,
                                  String attributeValue,
                                  boolean specified)
        Method addAttribute
        パラメータ:
        attributeType - a String
        attributePrefix - a String
        attributeNamespace - a String
        attributeName - a String
        attributeValue - a String
        specified - a boolean
        戻り値:
        a XmlAttribute
      • ensureAttributeCapacity

        void ensureAttributeCapacity​(int minCapacity)
        Method ensureAttributeCapacity
        パラメータ:
        minCapacity - an int
      • getAttributeValue

        String getAttributeValue​(String attributeNamespaceName,
                                 String attributeName)
        Method getAttributeValue
        パラメータ:
        attributeNamespaceNamea - String
        attributeName - a String
        戻り値:
        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)
        推奨されていません。
        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
        戻り値:
        a boolean
      • removeAttribute

        void removeAttribute​(XmlAttribute attr)
        Method removeAttribute
        パラメータ:
        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
        パラメータ:
        minCapacity - an int
      • hasNamespaceDeclarations

        boolean hasNamespaceDeclarations()
        Method hasNamespaceDeclarations
        戻り値:
        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
          パラメータ:
          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
          パラメータ:
          pos - an int (starting from 0)
          child - a XmlElement
          戻り値:
          a XmlElement
        • addElement

          XmlElement addElement​(String name)
          Method addElement
          パラメータ:
          name - a String
          戻り値:
          a XmlElement
        • addElement

          XmlElement addElement​(XmlNamespace namespace,
                                String name)
          Method addElement
          パラメータ:
          namespace - a XmlNamespace
          name - a String
          戻り値:
          a XmlElement
        • hasChildren

          boolean hasChildren()
          Method hasChildren
          戻り値:
          a boolean
        • hasChild

          boolean hasChild​(Object child)
          Method hasChild
          パラメータ:
          child - an Object
          戻り値:
          a boolean
        • ensureChildrenCapacity

          void ensureChildrenCapacity​(int minCapacity)
          Method ensureChildrenCapacity
          パラメータ:
          minCapacity - an int
        • findElementByName

          XmlElement findElementByName​(String name)
          推奨されていません。
          see element()
        • findElementByName

          XmlElement findElementByName​(String namespaceName,
                                       String name)
          推奨されていません。
          see element()
        • findElementByName

          XmlElement findElementByName​(String name,
                                       XmlElement elementToStartLooking)
          推奨されていません。
          see elements()
        • findElementByName

          XmlElement findElementByName​(String namespaceName,
                                       String name,
                                       XmlElement elementToStartLooking)
          推奨されていません。
          see elements()
        • 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
          パラメータ:
          namespace - a XmlNamespace
          name - a String
          戻り値:
          a XmlElement
        • newElement

          XmlElement newElement​(String namespaceName,
                                String name)
          Method newElement
          パラメータ:
          namespaceName - a String
          name - a String
          戻り値:
          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
          パラメータ:
          child - an Object
        • replaceChild

          void replaceChild​(Object newChild,
                            Object oldChild)
          Method replaceChild
          パラメータ:
          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.