パッケージ 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
-
-
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 static StringNO_NAMESPACE
-
メソッドの概要
すべてのメソッド インスタンス・メソッド abstractメソッド 推奨されていないメソッド 修飾子とタイプ メソッド 説明 XmlAttributeaddAttribute(String name, String value)addAttributeXmlAttributeaddAttribute(String attributeType, String attributePrefix, String attributeNamespace, String attributeName, String attributeValue, boolean specified)Method addAttributeXmlAttributeaddAttribute(String type, XmlNamespace namespace, String name, String value)Method addAttributeXmlAttributeaddAttribute(String type, XmlNamespace namespace, String name, String value, boolean specified)Method addAttributeXmlAttributeaddAttribute(XmlAttribute attributeValueToAdd)Add attribute (adds it to the XML Infoset [namespace attributes] set) Attribute mistXmlAttributeaddAttribute(XmlNamespace namespace, String name, String value)Method addAttributevoidaddChild(int pos, Object child)Method addChildvoidaddChild(Object child)NOTE: =child added is _not_ checked if it XmlContainer, caller must manually fix parent in child by calling setParent() !!!!XmlElementaddElement(int pos, XmlElement child)Method addElementXmlElementaddElement(String name)Method addElementXmlElementaddElement(XmlElement el)NOTE: the child element must unattached to be added (it is atttached if it is XmlContainer of recognized type and getParent() !XmlElementaddElement(XmlNamespace namespace, String name)Method addElementXmlAttributeattribute(String attributeName)Find attribute that matches given name or namespace Returns null if not found.XmlAttributeattribute(XmlNamespace attributeNamespaceName, String attributeName)Find attribute that matches given name or namespace Returns null if not found.Iteratorattributes()Return Iterator- null is never returned if there is no children then iteraotr over empty collection is returned Iteratorchildren()Return IteratorObjectclone()Method cloneXmlNamespacedeclareNamespace(String prefix, String namespaceName)Create new namespace with prefix and namespace name (both must be not null) and add it to current element.XmlNamespacedeclareNamespace(XmlNamespace namespace)Add namespace to current element (both prefix and namespace name must be not null)XmlElementelement(int position)return element at poition (0..count-1) or IndexOutOfBoundsException if positon incorrectXmlElementelement(XmlNamespace n, String name)find first element with name and namespace (if namespace is null it is ignored in search)XmlElementelement(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 returnedIterableelements(XmlNamespace n, String name)Return all elements that has namespace and name (null is never returned but empty iteraotr)voidensureAttributeCapacity(int minCapacity)Method ensureAttributeCapacityvoidensureChildrenCapacity(int minCapacity)Method ensureChildrenCapacityvoidensureNamespaceDeclarationsCapacity(int minCapacity)Method ensureNamespaceDeclarationsCapacityXmlAttributefindAttribute(String attributeNamespaceName, String attributeName)推奨されていません。Use attribute()XmlElementfindElementByName(String name)推奨されていません。see element()XmlElementfindElementByName(String namespaceName, String name)推奨されていません。see element()XmlElementfindElementByName(String namespaceName, String name, XmlElement elementToStartLooking)推奨されていません。see elements()XmlElementfindElementByName(String name, XmlElement elementToStartLooking)推奨されていません。see elements()StringgetAttributeValue(String attributeNamespaceName, String attributeName)Method getAttributeValueStringgetBaseUri()XML Infoset [base URI] propertyStringgetName()XML Infoset [local name] property.XmlNamespacegetNamespace()Return namespace of current element (XML Infoset [namespace name] and [prefix] properties combined) null is only returned if element was created without namespaceStringgetNamespaceName()Return namespace name (XML Infoset [namespace name]property or null if element has no namespaceXmlContainergetParent()XML Infoset [parent] property.XmlContainergetRoot()Get top most container that is either XmlDocument or XmlElement (may be event this element!!!)booleanhasAttributes()Method hasAttributesbooleanhasChild(Object child)Method hasChildbooleanhasChildren()Method hasChildrenbooleanhasNamespaceDeclarations()Method hasNamespaceDeclarationsvoidinsertChild(int pos, Object childToInsert)XmlNamespacelookupNamespaceByName(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).XmlNamespacelookupNamespaceByPrefix(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.Iteratornamespaces()Return Iterator- null is never returned if there is no children then iteraotr over empty collection is returned XmlElementnewElement(String name)Create unattached elementXmlElementnewElement(String namespaceName, String name)Method newElementXmlElementnewElement(XmlNamespace namespace, String name)Method newElementXmlNamespacenewNamespace(String namespaceName)Create new namespace with null prefix (namespace name must be not null).XmlNamespacenewNamespace(String prefix, String namespaceName)Create new namespace with prefix and namespace name (both must be not null).voidremoveAllAttributes()Method removeAllAttributesvoidremoveAllChildren()Removes all children - every child that was implementing XmlNode will have set parent to null.voidremoveAllNamespaceDeclarations()Method removeAllNamespaceDeclarationsvoidremoveAttribute(XmlAttribute attr)Method removeAttributevoidremoveChild(Object child)Method removeChildvoidreplaceChild(Object newChild, Object oldChild)Method replaceChildvoidreplaceChildrenWithText(String textContent)Remove all children and then add this text as only child.XmlElementrequiredElement(XmlNamespace n, String name)call element(n, name) and if null was returnedthrow XmlBuilderExceptionIterablerequiredElementContent()Return Iterator- that represents all XmlElement content. StringrequiredTextContent()return children content as text - if there are any no text children throw exceptionvoidsetBaseUri(String baseUri)XML Infoset [base URI] propertyvoidsetName(String name)XML Infoset [local name] property.voidsetNamespace(XmlNamespace namespace)Set namespace ot use for theis element.voidsetParent(XmlContainer parent)Method setParent
-
-
-
メソッドの詳細
-
clone
Object clone() throws CloneNotSupportedException
Method clone- 戻り値:
- an Object
- 例外:
CloneNotSupportedException
-
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 Stringvalue- a String- 戻り値:
- a XmlAttribute
-
addAttribute
XmlAttribute addAttribute(XmlNamespace namespace, String name, String value)
Method addAttribute- パラメータ:
namespace- a XmlNamespacename- a Stringvalue- a String- 戻り値:
- a XmlAttribute
-
addAttribute
XmlAttribute addAttribute(String type, XmlNamespace namespace, String name, String value)
Method addAttribute- パラメータ:
type- a Stringnamespace- a XmlNamespacename- a Stringvalue- a String- 戻り値:
- a XmlAttribute
-
addAttribute
XmlAttribute addAttribute(String type, XmlNamespace namespace, String name, String value, boolean specified)
Method addAttribute- パラメータ:
type- a Stringnamespace- a XmlNamespacename- a Stringvalue- a Stringspecified- a boolean- 戻り値:
- a XmlAttribute
-
addAttribute
XmlAttribute addAttribute(String attributeType, String attributePrefix, String attributeNamespace, String attributeName, String attributeValue, boolean specified)
Method addAttribute- パラメータ:
attributeType- a StringattributePrefix- a StringattributeNamespace- a StringattributeName- a StringattributeValue- a Stringspecified- a boolean- 戻り値:
- a XmlAttribute
-
ensureAttributeCapacity
void ensureAttributeCapacity(int minCapacity)
Method ensureAttributeCapacity- パラメータ:
minCapacity- an int
-
getAttributeValue
String getAttributeValue(String attributeNamespaceName, String attributeName)
Method getAttributeValue- パラメータ:
attributeNamespaceNamea- StringattributeName- 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
-
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 XmlNamespacename- 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
-
requiredElement
XmlElement requiredElement(XmlNamespace n, String name) throws XmlBuilderException
call element(n, name) and if null was returnedthrow XmlBuilderException
-
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(String name)
Create unattached element
-
newElement
XmlElement newElement(XmlNamespace namespace, String name)
Method newElement- パラメータ:
namespace- a XmlNamespacename- a String- 戻り値:
- a XmlElement
-
newElement
XmlElement newElement(String namespaceName, String name)
Method newElement- パラメータ:
namespaceName- a Stringname- 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 ObjectoldChild- 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.
-
-