|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.xml.Node
org.apache.pivot.xml.Element
public class Element
Node class representing an XML element.
Nested Class Summary | |
---|---|
static class |
Element.Attribute
Class representing an XML attribute. |
class |
Element.AttributeSequence
Sequence representing the attributes declared by this element. |
class |
Element.ElementDictionary
Dictionary representing the attributes declared by this element. |
class |
Element.NamespaceDictionary
Dictionary representing the namespaces declared by this element. |
Nested classes/interfaces inherited from interface org.apache.pivot.collections.List |
---|
List.ItemIterator<T>, List.ListListenerList<T> |
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence |
---|
Sequence.Tree<T> |
Constructor Summary | |
---|---|
Element(String localName)
|
|
Element(String namespacePrefix,
String localName)
|
Method Summary | |
---|---|
int |
add(Node node)
Adds a node to this element. |
void |
clear()
Removes all nodes from this element. |
Node |
get(int index)
Returns the node at the given index. |
Element.AttributeSequence |
getAttributes()
Returns the element's attribute dictionary. |
Comparator<Node> |
getComparator()
Returns the collection's sort order. |
String |
getDefaultNamespaceURI()
Returns the element's default namespace URI. |
Element.ElementDictionary |
getElementDictionary()
Returns the element's element dictionary. |
ListenerList<ElementListener> |
getElementListeners()
Returns the element listener list. |
List<Element> |
getElements(String name)
Returns the sub-elements of of this element whose tag names match the given name. |
int |
getLength()
Returns the number of nodes contained by this element. |
ListenerList<ListListener<Node>> |
getListListeners()
Returns the element's listener list. |
String |
getLocalName()
Returns the element's local name. |
String |
getName()
Returns the fully-qualified name of the element. |
String |
getNamespacePrefix()
Returns the element's namespace prefix. |
Element.NamespaceDictionary |
getNamespaces()
Returns the element's namespace dictionary. |
String |
getNamespaceURI(String prefix)
Determines the namespace URI corresponding to the given prefix by traversing the element's ancestry. |
String |
getText()
Returns the text content of this element. |
int |
indexOf(Node node)
Determines the index of the given node within this element. |
void |
insert(Node node,
int index)
Inserts a node at a specific location within this element. |
boolean |
isEmpty()
Determines if this element defines any attributes. |
Iterator<Node> |
iterator()
Returns an iterator over this elements child nodes. |
Sequence<Node> |
remove(int index,
int count)
Removes a range of nodes from this element. |
int |
remove(Node node)
Removes a node from this element. |
void |
setComparator(Comparator<Node> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
void |
setDefaultNamespaceURI(String defaultNamespaceURI)
Sets the element's default namespace URI. |
String |
toString()
|
Node |
update(int index,
Node node)
Updates the item at the given index. |
Methods inherited from class org.apache.pivot.xml.Node |
---|
getNodeListeners, getParent, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Element(String localName)
public Element(String namespacePrefix, String localName)
Method Detail |
---|
public String getNamespacePrefix()
public String getLocalName()
public String getName()
public String getDefaultNamespaceURI()
public void setDefaultNamespaceURI(String defaultNamespaceURI)
defaultNamespaceURI
- The default namespace URI declared by this element, or null if
this element does not declare a default namespace.public Element.NamespaceDictionary getNamespaces()
public String getNamespaceURI(String prefix)
prefix
- The namespace prefix to look up, or null to determine the default
namespace for this element.
public Element.ElementDictionary getElementDictionary()
public Element.AttributeSequence getAttributes()
public int add(Node node)
add
in interface List<Node>
add
in interface Sequence<Node>
node
-
ListListener.itemInserted(List, int)
public void insert(Node node, int index)
insert
in interface List<Node>
insert
in interface Sequence<Node>
node
- index
- ListListener.itemInserted(List, int)
public Node update(int index, Node node)
List
update
in interface List<Node>
update
in interface Sequence<Node>
index
- The index of the item to update.node
- The item that will replace any existing value at the given index.
UnsupportedOperationException
- This method is not supported.ListListener.itemUpdated(List, int, Object)
public int remove(Node node)
remove
in interface Sequence<Node>
node
-
Sequence.remove(int, int)
public Sequence<Node> remove(int index, int count)
remove
in interface List<Node>
remove
in interface Sequence<Node>
index
- count
-
ListListener.itemsRemoved(List, int, Sequence)
public void clear()
clear
in interface Collection<Node>
clear
in interface List<Node>
ListListener.itemsRemoved(List, int, Sequence)
public Node get(int index)
get
in interface Sequence<Node>
index
- public int indexOf(Node node)
indexOf
in interface Sequence<Node>
node
- The item to locate.
public int getLength()
getLength
in interface List<Node>
getLength
in interface Sequence<Node>
public Comparator<Node> getComparator()
Collection
getComparator
in interface Collection<Node>
Collection.setComparator(Comparator)
public void setComparator(Comparator<Node> comparator)
Collection
Calling this method more than once with the same comparator will re-sort the collection.
setComparator
in interface Collection<Node>
setComparator
in interface List<Node>
comparator
- The comparator used to order elements in the collection, or null if the
collection is unsorted.
UnsupportedOperationException
- Elements cannot be sorted.ListListener.comparatorChanged(List, Comparator)
public Iterator<Node> iterator()
iterator
in interface Iterable<Node>
public boolean isEmpty()
isEmpty
in interface Collection<Node>
public List<Element> getElements(String name)
name
- The tag name to match.
public String getText()
TextNode
.
null
if this element does
not contain text.public ListenerList<ListListener<Node>> getListListeners()
getListListeners
in interface List<Node>
public ListenerList<ElementListener> getElementListeners()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |