public interface XmlElement extends XmlContainer, XmlContained, Cloneable
| Modifier and Type | Field and Description |
|---|---|
static String |
NO_NAMESPACE |
| Modifier and Type | Method and Description |
|---|---|
XmlAttribute |
addAttribute(String name,
String value)
addAttribute
|
XmlAttribute |
addAttribute(String attributeType,
String attributePrefix,
String attributeNamespace,
String attributeName,
String attributeValue,
boolean specified)
Method addAttribute
|
XmlAttribute |
addAttribute(String type,
XmlNamespace namespace,
String name,
String value)
Method addAttribute
|
XmlAttribute |
addAttribute(String type,
XmlNamespace namespace,
String name,
String value,
boolean specified)
Method addAttribute
|
XmlAttribute |
addAttribute(XmlAttribute attributeValueToAdd)
Add attribute (adds it to the XML Infoset [namespace attributes] set)
Attribute mist
|
XmlAttribute |
addAttribute(XmlNamespace namespace,
String name,
String value)
Method addAttribute
|
void |
addChild(int pos,
Object child)
Method addChild
|
void |
addChild(Object child)
NOTE: =child added is _not_ checked if it XmlContainer, caller must manually fix
parent in child by calling setParent() !!!!
|
XmlElement |
addElement(int pos,
XmlElement child)
Method addElement
|
XmlElement |
addElement(String name)
Method 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)
|
XmlElement |
addElement(XmlNamespace namespace,
String name)
Method addElement
|
XmlAttribute |
attribute(String attributeName)
Find attribute that matches given name or namespace
Returns null if not found.
|
XmlAttribute |
attribute(XmlNamespace attributeNamespaceName,
String attributeName)
Find attribute that matches given name or namespace
Returns null if not found.
|
Iterator |
attributes()
Return Iterator
|
Iterator |
children()
Return Iterator
|
Object |
clone()
Method clone
|
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.
|
XmlNamespace |
declareNamespace(XmlNamespace namespace)
Add namespace to current element (both prefix and namespace name must be not null)
|
XmlElement |
element(int position)
return element at poition (0..count-1) or IndexOutOfBoundsException if positon incorrect
|
XmlElement |
element(XmlNamespace n,
String name)
find first element with name and namespace (if namespace is null it is ignored in search)
|
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
|
Iterable |
elements(XmlNamespace n,
String name)
Return all elements that has namespace and name (null is never returned but empty iteraotr)
|
void |
ensureAttributeCapacity(int minCapacity)
Method ensureAttributeCapacity
|
void |
ensureChildrenCapacity(int minCapacity)
Method ensureChildrenCapacity
|
void |
ensureNamespaceDeclarationsCapacity(int minCapacity)
Method ensureNamespaceDeclarationsCapacity
|
XmlAttribute |
findAttribute(String attributeNamespaceName,
String attributeName)
Deprecated.
Use attribute()
|
XmlElement |
findElementByName(String name)
Deprecated.
see element()
|
XmlElement |
findElementByName(String namespaceName,
String name)
Deprecated.
see element()
|
XmlElement |
findElementByName(String namespaceName,
String name,
XmlElement elementToStartLooking)
Deprecated.
see elements()
|
XmlElement |
findElementByName(String name,
XmlElement elementToStartLooking)
Deprecated.
see elements()
|
String |
getAttributeValue(String attributeNamespaceName,
String attributeName)
Method getAttributeValue
|
String |
getBaseUri()
XML Infoset [base URI] property
|
String |
getName()
XML Infoset [local name] property.
|
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
|
String |
getNamespaceName()
Return namespace name (XML Infoset [namespace name]property
or null if element has no namespace
|
XmlContainer |
getParent()
XML Infoset [parent] property.
|
XmlContainer |
getRoot()
Get top most container that is either XmlDocument or XmlElement (may be event this element!!!)
|
boolean |
hasAttributes()
Method hasAttributes
|
boolean |
hasChild(Object child)
Method hasChild
|
boolean |
hasChildren()
Method hasChildren
|
boolean |
hasNamespaceDeclarations()
Method hasNamespaceDeclarations
|
void |
insertChild(int pos,
Object childToInsert) |
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).
|
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.
|
Iterator |
namespaces()
Return Iterator
|
XmlElement |
newElement(String name)
Create unattached element
|
XmlElement |
newElement(String namespaceName,
String name)
Method newElement
|
XmlElement |
newElement(XmlNamespace namespace,
String name)
Method newElement
|
XmlNamespace |
newNamespace(String namespaceName)
Create new namespace with null prefix (namespace name must be not null).
|
XmlNamespace |
newNamespace(String prefix,
String namespaceName)
Create new namespace with prefix and namespace name (both must be not null).
|
void |
removeAllAttributes()
Method removeAllAttributes
|
void |
removeAllChildren()
Removes all children - every child that was
implementing XmlNode will have set parent to null.
|
void |
removeAllNamespaceDeclarations()
Method removeAllNamespaceDeclarations
|
void |
removeAttribute(XmlAttribute attr)
Method removeAttribute
|
void |
removeChild(Object child)
Method removeChild
|
void |
replaceChild(Object newChild,
Object oldChild)
Method replaceChild
|
void |
replaceChildrenWithText(String textContent)
Remove all children and then add this text as only child.
|
XmlElement |
requiredElement(XmlNamespace n,
String name)
call element(n, name) and if null was returnedthrow XmlBuilderException
|
Iterable |
requiredElementContent()
Return Iterator
|
String |
requiredTextContent()
return children content as text - if there are any no text children throw exception
|
void |
setBaseUri(String baseUri)
XML Infoset [base URI] property
|
void |
setName(String name)
XML Infoset [local name] property.
|
void |
setNamespace(XmlNamespace namespace)
Set namespace ot use for theis element.
|
void |
setParent(XmlContainer parent)
Method setParent
|
static final String NO_NAMESPACE
Object clone() throws CloneNotSupportedException
CloneNotSupportedExceptionString getBaseUri()
void setBaseUri(String baseUri)
baseUri - a StringXmlContainer getRoot()
XmlContainer getParent()
getParent in interface XmlContainedvoid setParent(XmlContainer parent)
setParent in interface XmlContainedparent - a XmlContainerXmlNamespace getNamespace()
String getNamespaceName()
void setNamespace(XmlNamespace namespace)
String getName()
void setName(String name)
name - a StringIterator attributes()
XmlAttribute addAttribute(XmlAttribute attributeValueToAdd)
attributeValueToAdd - a XmlAttributeXmlAttribute addAttribute(String name, String value)
name - a Stringvalue - a StringXmlAttribute addAttribute(XmlNamespace namespace, String name, String value)
namespace - a XmlNamespacename - a Stringvalue - a StringXmlAttribute addAttribute(String type, XmlNamespace namespace, String name, String value)
type - a Stringnamespace - a XmlNamespacename - a Stringvalue - a StringXmlAttribute addAttribute(String type, XmlNamespace namespace, String name, String value, boolean specified)
type - a Stringnamespace - a XmlNamespacename - a Stringvalue - a Stringspecified - a booleanXmlAttribute addAttribute(String attributeType, String attributePrefix, String attributeNamespace, String attributeName, String attributeValue, boolean specified)
attributeType - a StringattributePrefix - a StringattributeNamespace - a StringattributeName - a StringattributeValue - a Stringspecified - a booleanvoid ensureAttributeCapacity(int minCapacity)
minCapacity - an intString getAttributeValue(String attributeNamespaceName, String attributeName)
attributeNamespaceName - a StringattributeName - a StringXmlAttribute attribute(String attributeName)
XmlAttribute attribute(XmlNamespace attributeNamespaceName, String attributeName)
XmlAttribute findAttribute(String attributeNamespaceName, String attributeName)
boolean hasAttributes()
void removeAttribute(XmlAttribute attr)
attr - a XmlAttributevoid removeAllAttributes()
Iterator namespaces()
XmlNamespace declareNamespace(String prefix, String namespaceName)
XmlNamespace declareNamespace(XmlNamespace namespace)
void ensureNamespaceDeclarationsCapacity(int minCapacity)
minCapacity - an intboolean hasNamespaceDeclarations()
XmlNamespace lookupNamespaceByPrefix(String namespacePrefix)
XmlNamespace lookupNamespaceByName(String namespaceName)
XmlNamespace newNamespace(String namespaceName)
XmlNamespace newNamespace(String prefix, String namespaceName)
void removeAllNamespaceDeclarations()
Iterator children()
void addChild(Object child)
void addChild(int pos,
Object child)
pos - an int (starting from 0)child - an ObjectXmlElement addElement(XmlElement el)
XmlElement addElement(int pos, XmlElement child)
pos - an int (starting from 0)child - a XmlElementXmlElement addElement(String name)
name - a StringXmlElement addElement(XmlNamespace namespace, String name)
namespace - a XmlNamespacename - a Stringboolean hasChildren()
boolean hasChild(Object child)
child - an Objectvoid ensureChildrenCapacity(int minCapacity)
minCapacity - an intXmlElement findElementByName(String name)
XmlElement findElementByName(String namespaceName, String name)
XmlElement findElementByName(String name, XmlElement elementToStartLooking)
XmlElement findElementByName(String namespaceName, String name, XmlElement elementToStartLooking)
XmlElement element(int position)
XmlElement requiredElement(XmlNamespace n, String name) throws XmlBuilderException
XmlBuilderExceptionXmlElement element(XmlNamespace n, String name)
XmlElement element(XmlNamespace n, String name, boolean create)
Iterable elements(XmlNamespace n, String name)
void insertChild(int pos,
Object childToInsert)
XmlElement newElement(String name)
XmlElement newElement(XmlNamespace namespace, String name)
namespace - a XmlNamespacename - a StringXmlElement newElement(String namespaceName, String name)
namespaceName - a Stringname - a Stringvoid removeAllChildren()
void removeChild(Object child)
child - an Objectvoid replaceChild(Object newChild, Object oldChild)
newChild - an ObjectoldChild - an ObjectIterable requiredElementContent()
String requiredTextContent()
void replaceChildrenWithText(String textContent)
Copyright © 2013. All Rights Reserved.