Top Description Inners Fields Constructors Methods
nu.xom

public Class Element

extends ParentNode
Class Inheritance
Imports
java.util.HashMap, .HashSet, .Iterator, .Map, .NoSuchElementException, .Set, .LinkedHashSet

This class represents an XML element. Each element has the following properties:

Author
Elliotte Rusty Harold
Version
1.3.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private Attribute[]
private String
pack-priv Namespaces
private int
private String
private String
Inherited from nu.xom.ParentNode:
actualBaseURIchildCountchildren

Constructor Summary

AccessConstructor and Description
public
Element(String
the name of the element
name
)

Creates a new element in no namespace.

public
Element(String
the qualified name of the element
name
,
String
the namespace URI of the element
uri
)

Creates a new element in a namespace.

private
public
Element(Element
the element to copy
element
)

Creates a deep copy of an element.

Method Summary

Modifier and TypeMethod and Description
private void
_setLocalName(String localName)

private void
private void
private void
add(Attribute attribute)

public void
addAttribute(Attribute
the attribute to add
attribute
)

Adds an attribute to this element, replacing any existing attribute with the same local name and namespace URI.

public void
addNamespaceDeclaration(String
the prefix to declare
prefix
,
String
the absolute URI reference to map the prefix to
uri
)

Declares a namespace prefix.

private void
public void
appendChild(String
String to add to this node
text
)

Converts a string to a text node and appends that node to the children of this node.

pack-priv Iterator<Attribute>
pack-priv static Element
build(String name, String uri, String localName)

private static void
checkCycle(Node child, ParentNode parent)

private void
public Element

Returns:

a deep copy of this element with no parent
copy
()

Implements abstract nu.xom.Node.copy.

Creates a deep copy of this element with no parent, that can be added to this document or a different one.

private Attribute[]
private static void
copyChildren(final Element sourceElement, Element resultElement)

private static Element
copyTag(final Element source)

private static String
pack-priv void
public final Attribute

Returns:

the attribute of this element with the specified name
getAttribute
(String
the name of the attribute
name
)

Returns the attribute with the specified name in no namespace, or null if this element does not have an attribute with that name in no namespace.

public final Attribute

Returns:

the attribute of this element with the specified name and namespace
getAttribute
(String
the local name of the attribute
localName
,
String
the namespace of the attribute
namespaceURI
)

Returns the attribute with the specified name and namespace URI, or null if this element does not have an attribute with that name in that namespace.

public final Attribute

Returns:

the indexth attribute of this element
getAttribute
(int
the attribute to return
index
)

Selects an attribute by index.

public final int

Returns:

the number of attributes in the container
getAttributeCount
()

Returns the number of attributes of this Element, not counting namespace declarations.

public final String

Returns:

the value of the attribute of this element with the specified name
getAttributeValue
(String
the name of the attribute
name
)

Returns the value of the attribute with the specified name in no namespace, or null if this element does not have an attribute with that name.

public final String

Returns:

the value of the attribute of this element with the specified name and namespace
getAttributeValue
(String
the name of the attribute
localName
,
String
the namespace of the attribute
namespaceURI
)

Returns the value of the attribute with the specified name and namespace URI, or null if this element does not have such an attribute.

public String

Returns:

the base URI of this element
getBaseURI
()

Overrides nu.xom.Node.getBaseURI.

Returns the absolute base URI against which relative URIs in this element should be resolved.

public final Elements

Returns:

a comatose list containing the child elements of this element with the specified name
getChildElements
(String
the name of the elements included in the list
name
)

Returns a list of the child elements of this element with the specified name in no namespace.

public final Elements

Returns:

a comatose list containing the child elements of this element with the specified name in the specified namespace
getChildElements
(String
the name of the elements included in the list
localName
,
String
the namespace URI of the elements included in the list
namespaceURI
)

Returns a list of the immediate child elements of this element with the specified local name and namespace URI.

public final Elements

Returns:

a comatose list containing all child elements of this element
getChildElements
()

Returns a list of all the child elements of this element in document order.

private String
public final Element

Returns:

the first child element with the specified local name in no namespace or null if there is no such element
getFirstChildElement
(String
the name of the element to return
name
)

Returns the first child element with the specified name in no namespace.

public final Element

Returns:

the first child with the specified local name in the specified namespace, or null if there is no such element
getFirstChildElement
(String
the local name of the element to return
localName
,
String
the namespace URI of the element to return
namespaceURI
)

Returns the first child element with the specified local name and namespace URI.

public final String

Returns:

the local name of this element
getLocalName
()

Returns the local name of this element, not including the namespace prefix or colon.

pack-priv final String
public final int

Returns:

the number of namespaces declared by this element
getNamespaceDeclarationCount
()

Returns the number of namespace declarations on this element.

public final String

Returns:

the prefix of this element
getNamespacePrefix
()

Returns the prefix of this element, or the empty string if this element does not have a prefix.

public final String

Returns:

the prefix
getNamespacePrefix
(int
the prefix to return
index
)

Returns the indexth namespace prefix declared on this element.

private Set<String>
pack-priv Map<String, String>
public final String

Returns:

the namespace URI of this element
getNamespaceURI
()

Returns the namespace URI of this element, or the empty string if this element is not in a namespace.

public final String

Returns:

the namespace URI mapped to prefix
getNamespaceURI
(String
the namespace prefix whose URI is desired
prefix
)

Returns the namespace URI mapped to the specified prefix within this element.

public final String

Returns:

the qualified name of this element
getQualifiedName
()

Returns the complete name of this element, including the namespace prefix if this element has one.

public final String

Returns:

XPath string value of this element
getValue
()

Implements abstract nu.xom.Node.getValue.

Returns the value of the element as defined by XPath 1.0.

private static int[]
grow(int[] indexes, int top)

public void
insertChild(String
the string to convert to a text node and insert
text
,
int
where to insert the child
position
)

Converts a string to a text node and inserts that node at the specified position.

pack-priv void
insertionAllowed(Node
the node to insert
child
,
int
where to insert the child
position
)

Implements abstract nu.xom.ParentNode.insertionAllowed.

Inserts a child node at the specified position.

pack-priv boolean
private boolean
private boolean
remove(Attribute attribute)

public Attribute

Returns:

the attribute that was removed
removeAttribute
(Attribute
the attribute to remove
attribute
)

Removes an attribute from this element.

public Nodes

Returns:

a list of all the children removed in the order they appeared in the element
removeChildren
()

Detaches all children from this node.

public void
removeNamespaceDeclaration(String
the prefix whose declaration should be removed
prefix
)

Removes the mapping of the specified prefix.

public void
setBaseURI(String
the new base URI for this element
URI
)

Implements abstract nu.xom.ParentNode.setBaseURI.

Sets the URI from which this element was loaded, and against which relative URLs in this element will be resolved, unless an xml:base attribute overrides this.

public void
setLocalName(String
the new local name
localName
)

Sets the local name of this element.

public void
setNamespacePrefix(String
the new namespace prefix
prefix
)

Sets the namespace prefix of this element.

public void
setNamespaceURI(String
the new namespace URI
uri
)

Sets the namespace URI of this element.

protected Element

Returns:

an empty element with the same name and namespace as this element
shallowCopy
()

Creates a very shallow copy of the element with the same name and namespace URI, but no children, attributes, base URI, or namespace declaration.

public String

Returns:

a non-XML string representation of this element
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this element suitable for debugging and diagnosis.

public final String

Returns:

the XML representation of this element
toXML
()

Implements abstract nu.xom.Node.toXML.

Returns a string containing the XML serialization of this element.

private static void
private static void
Inherited from nu.xom.ParentNode:
_insertChildappendChildfastInsertChildfillInBaseURIfindActualBaseURIgetActualBaseURIgetChildgetChildCountindexOfinsertChildremoveChildremoveChildreplaceChildsetActualBaseURI

Field Detail

attributesback to summary
private Attribute[] attributes
localNameback to summary
private String localName
namespacesback to summary
pack-priv Namespaces namespaces
numAttributesback to summary
private int numAttributes
prefixback to summary
private String prefix
URIback to summary
private String URI

Constructor Detail

Elementback to summary
public Element(String name)

Creates a new element in no namespace.

Parameters
name:String

the name of the element

Exceptions
IllegalNameException:
if name is not a legal XML 1.0 non-colonized name
Elementback to summary
public Element(String name, String uri)

Creates a new element in a namespace.

Parameters
name:String

the qualified name of the element

uri:String

the namespace URI of the element

Exceptions
IllegalNameException:
if name is not a legal XML 1.0 name
NamespaceConflictException:
if name's prefix cannot be used with uri
MalformedURIException:
if uri is not an RFC 3986 absolute URI reference
Elementback to summary
private Element()
Elementback to summary
public Element(Element element)

Creates a deep copy of an element. The copy is disconnected from the tree, and does not have a parent.

Parameters
element:Element

the element to copy

Method Detail

_setLocalNameback to summary
private void _setLocalName(String localName)
_setNamespacePrefixback to summary
private void _setNamespacePrefix(String prefix)
_setNamespaceURIback to summary
private void _setNamespaceURI(String uri)
addback to summary
private void add(Attribute attribute)
addAttributeback to summary
public void addAttribute(Attribute attribute)

Adds an attribute to this element, replacing any existing attribute with the same local name and namespace URI.

Parameters
attribute:Attribute

the attribute to add

Exceptions
MultipleParentException:
if the attribute is already attached to an element
NamespaceConflictException:
if the attribute's prefix is mapped to a different namespace URI than the same prefix is mapped to by this element, another attribute of this element, or an additional namespace declaration of this element
addNamespaceDeclarationback to summary
public void addNamespaceDeclaration(String prefix, String uri)

Declares a namespace prefix. This is only necessary when prefixes are used in element content and attribute values, as in XSLT and the W3C XML Schema Language. Do not use this method to declare prefixes for element and attribute names.

You can supply an empty string for the prefix to declare a default namespace, provided the element itself has a prefix.

If you do redeclare a prefix that is already used by an element or attribute name, the additional namespace is added if and only if the URI is the same. Conflicting namespace declarations will throw an exception.

Parameters
prefix:String

the prefix to declare

uri:String

the absolute URI reference to map the prefix to

Exceptions
MalformedURIException:
if URI is not an RFC 3986 URI reference
IllegalNameException:
if prefix is not a legal XML non-colonized name or the empty string
NamespaceConflictException:
if the mapping conflicts with an existing element, attribute, or additional namespace declaration
addPrefixIfNotAlreadyPresentback to summary
private void addPrefixIfNotAlreadyPresent(HashMap<String, String> namespaces, Element current, String prefix)
appendChildback to summary
public void appendChild(String text)

Converts a string to a text node and appends that node to the children of this node.

Parameters
text:String

String to add to this node

Exceptions
IllegalAddException:
if this node cannot have children of this type
NullPointerException:
if text is null
attributeIteratorback to summary
pack-priv Iterator<Attribute> attributeIterator()
buildback to summary
pack-priv static Element build(String name, String uri, String localName)
checkCycleback to summary
private static void checkCycle(Node child, ParentNode parent)
checkPrefixConflictback to summary
private void checkPrefixConflict(Attribute attribute)
copyback to summary
public Element copy()

Implements abstract nu.xom.Node.copy.

Creates a deep copy of this element with no parent, that can be added to this document or a different one.

Subclassers should be wary. Implementing this method is trickier than it might seem, especially if you wish to avoid potential stack overflows in deep documents. In particular, you should not rely on the obvious recursive algorithm. Most subclasses should override the shallowCopy method instead.

Returns:Element

a deep copy of this element with no parent

copyAttributesback to summary
private Attribute[] copyAttributes(Element newParent)
copyChildrenback to summary
private static void copyChildren(final Element sourceElement, Element resultElement)
copyTagback to summary
private static Element copyTag(final Element source)
escapeback to summary
private static String escape(String s)
fastAddAttributeback to summary
pack-priv void fastAddAttribute(Attribute attribute)
getAttributeback to summary
public final Attribute getAttribute(String name)

Returns the attribute with the specified name in no namespace, or null if this element does not have an attribute with that name in no namespace.

Parameters
name:String

the name of the attribute

Returns:Attribute

the attribute of this element with the specified name

getAttributeback to summary
public final Attribute getAttribute(String localName, String namespaceURI)

Returns the attribute with the specified name and namespace URI, or null if this element does not have an attribute with that name in that namespace.

Parameters
localName:String

the local name of the attribute

namespaceURI:String

the namespace of the attribute

Returns:Attribute

the attribute of this element with the specified name and namespace

getAttributeback to summary
public final Attribute getAttribute(int index)

Selects an attribute by index. The index is purely for convenience and has no particular meaning. In particular, it is not necessarily the position of this attribute in the original document from which this Element object was read. As with most lists in Java, attributes are numbered from 0 to one less than the length of the list.

In general, you should not add attributes to or remove attributes from the list while iterating across it. Doing so will change the indexes of the other attributes in the list. it is, however, safe to remove an attribute from either end of the list (0 or getAttributeCount()-1) until there are no attributes left.

Parameters
index:int

the attribute to return

Returns:Attribute

the indexth attribute of this element

Exceptions
IndexOutOfBoundsException:
if the index is negative or greater than or equal to the number of attributes of this element
getAttributeCountback to summary
public final int getAttributeCount()

Returns the number of attributes of this Element, not counting namespace declarations. This is always a non-negative number.

Returns:int

the number of attributes in the container

getAttributeValueback to summary
public final String getAttributeValue(String name)

Returns the value of the attribute with the specified name in no namespace, or null if this element does not have an attribute with that name.

Parameters
name:String

the name of the attribute

Returns:String

the value of the attribute of this element with the specified name

getAttributeValueback to summary
public final String getAttributeValue(String localName, String namespaceURI)

Returns the value of the attribute with the specified name and namespace URI, or null if this element does not have such an attribute.

Parameters
localName:String

the name of the attribute

namespaceURI:String

the namespace of the attribute

Returns:String

the value of the attribute of this element with the specified name and namespace

getBaseURIback to summary
public String getBaseURI()

Overrides nu.xom.Node.getBaseURI.

Returns the absolute base URI against which relative URIs in this element should be resolved. xml:base attributes in the same entity take precedence over the actual base URI of the document where the element was found or which was set by setBaseURI.

This URI is made absolute before it is returned by resolving the information in this element against the information in its parent element and document entity. However, it is not always possible to fully absolutize the URI in all circumstances. In this case, this method returns the empty string to indicate the base URI of the current entity.

If the element's xml:base attribute contains a value that is a syntactically illegal URI (e.g. %GF.html"), then the base URI is application dependent. XOM's choice is to behave as if the element did not have an xml:base attribute.

Returns:String

the base URI of this element

getChildElementsback to summary
public final Elements getChildElements(String name)

Returns a list of the child elements of this element with the specified name in no namespace. The elements returned are in document order.

Parameters
name:String

the name of the elements included in the list

Returns:Elements

a comatose list containing the child elements of this element with the specified name

getChildElementsback to summary
public final Elements getChildElements(String localName, String namespaceURI)

Returns a list of the immediate child elements of this element with the specified local name and namespace URI. Passing the empty string or null as the local name returns all elements in the specified namespace. Passing null or the empty string as the namespace URI returns elements with the specified name in no namespace. The elements returned are in document order.

Parameters
localName:String

the name of the elements included in the list

namespaceURI:String

the namespace URI of the elements included in the list

Returns:Elements

a comatose list containing the child elements of this element with the specified name in the specified namespace

getChildElementsback to summary
public final Elements getChildElements()

Returns a list of all the child elements of this element in document order.

Returns:Elements

a comatose list containing all child elements of this element

getEntityURIback to summary
private String getEntityURI()
getFirstChildElementback to summary
public final Element getFirstChildElement(String name)

Returns the first child element with the specified name in no namespace. If there is no such element, it returns null.

Parameters
name:String

the name of the element to return

Returns:Element

the first child element with the specified local name in no namespace or null if there is no such element

getFirstChildElementback to summary
public final Element getFirstChildElement(String localName, String namespaceURI)

Returns the first child element with the specified local name and namespace URI. If there is no such element, it returns null.

Parameters
localName:String

the local name of the element to return

namespaceURI:String

the namespace URI of the element to return

Returns:Element

the first child with the specified local name in the specified namespace, or null if there is no such element

getLocalNameback to summary
public final String getLocalName()

Returns the local name of this element, not including the namespace prefix or colon.

Returns:String

the local name of this element

getLocalNamespaceURIback to summary
pack-priv final String getLocalNamespaceURI(String prefix)
getNamespaceDeclarationCountback to summary
public final int getNamespaceDeclarationCount()

Returns the number of namespace declarations on this element. This counts the namespace of the element itself (which may be the empty string), the namespace of each attribute, and each namespace added by addNamespaceDeclaration. However, prefixes used multiple times are only counted once; and the xml prefix used for xml:base, xml:lang, and xml:space is not counted even if one of these attributes is present on the element.

The return value is almost always positive. It can be zero if and only if the element itself has the prefix xml; e.g. <xml:space />. This is not endorsed by the XML specification. The prefix xml is reserved for use by the W3C, which has only used it for attributes to date. You really shouldn't do this. Nonetheless, this is not malformed so XOM allows it.

Returns:int

the number of namespaces declared by this element

getNamespacePrefixback to summary
public final String getNamespacePrefix()

Returns the prefix of this element, or the empty string if this element does not have a prefix.

Returns:String

the prefix of this element

getNamespacePrefixback to summary
public final String getNamespacePrefix(int index)

Returns the indexth namespace prefix declared on this element. Namespaces inherited from ancestors are not included. The index is purely for convenience, and has no meaning in itself. This includes the namespaces of the element name and of all attributes' names (except for those with the prefix xml such as xml:space) as well as additional declarations made for attribute values and element content. However, prefixes used multiple times (e.g. on several attribute values) are only reported once. The default namespace is reported with an empty string prefix if present. Like most lists in Java, the first prefix is at index 0.

If the namespaces on the element change for any reason (adding or removing an attribute in a namespace, adding or removing a namespace declaration, changing the prefix of an element, etc.) then this method may skip or repeat prefixes. Don't change the prefixes of an element while iterating across them.

Parameters
index:int

the prefix to return

Returns:String

the prefix

Exceptions
IndexOutOfBoundsException:
if index is negative or greater than or equal to the number of namespaces declared by this element.
getNamespacePrefixesback to summary
private Set<String> getNamespacePrefixes()
getNamespacePrefixesInScopeback to summary
pack-priv Map<String, String> getNamespacePrefixesInScope()
getNamespaceURIback to summary
public final String getNamespaceURI()

Returns the namespace URI of this element, or the empty string if this element is not in a namespace.

Returns:String

the namespace URI of this element

getNamespaceURIback to summary
public final String getNamespaceURI(String prefix)

Returns the namespace URI mapped to the specified prefix within this element. Returns null if this prefix is not associated with a URI.

Parameters
prefix:String

the namespace prefix whose URI is desired

Returns:String

the namespace URI mapped to prefix

getQualifiedNameback to summary
public final String getQualifiedName()

Returns the complete name of this element, including the namespace prefix if this element has one.

Returns:String

the qualified name of this element

getValueback to summary
public final String getValue()

Implements abstract nu.xom.Node.getValue.

Returns the value of the element as defined by XPath 1.0. This is the complete PCDATA content of the element, without any tags, comments, or processing instructions after all entity and character references have been resolved.

Returns:String

XPath string value of this element

growback to summary
private static int[] grow(int[] indexes, int top)
insertChildback to summary
public void insertChild(String text, int position)

Converts a string to a text node and inserts that node at the specified position.

Parameters
text:String

the string to convert to a text node and insert

position:int

where to insert the child

Exceptions
NullPointerException:
if text is null
IndexOutOfBoundsException:
if the position is negative or greater than the number of children of the node
insertionAllowedback to summary
pack-priv void insertionAllowed(Node child, int position)

Implements abstract nu.xom.ParentNode.insertionAllowed.

Inserts a child node at the specified position. Inserting at position 0 makes the child the first child of this node. Inserting at the position getChildCount() makes the child the last child of the node.

All the other methods that add a node to the tree, invoke this method ultimately.

Parameters
child:Node

the node to insert

position:int

where to insert the child

Exceptions
IllegalAddException:
if child is a Document
MultipleParentException:
if child already has a parent
NullPointerException:
if child is null
IndexOutOfBoundsException:
if the position is negative or greater than the number of children of this element.
isElementback to summary
pack-priv boolean isElement()

Overrides nu.xom.Node.isElement.

legalURIback to summary
private boolean legalURI(String base)
removeback to summary
private boolean remove(Attribute attribute)
removeAttributeback to summary
public Attribute removeAttribute(Attribute attribute)

Removes an attribute from this element.

Parameters
attribute:Attribute

the attribute to remove

Returns:Attribute

the attribute that was removed

Exceptions
NoSuchAttributeException:
if this element is not the parent of attribute
removeChildrenback to summary
public Nodes removeChildren()

Detaches all children from this node.

Subclassers should note that the default implementation of this method does not call removeChild or detach. If you override removeChild, you'll probably need to override this method as well.

Returns:Nodes

a list of all the children removed in the order they appeared in the element

removeNamespaceDeclarationback to summary
public void removeNamespaceDeclaration(String prefix)

Removes the mapping of the specified prefix. This method only removes additional namespaces added with addNamespaceDeclaration. It has no effect on namespaces of elements and attributes. If the prefix is not used on this element, this method does nothing.

Parameters
prefix:String

the prefix whose declaration should be removed

setBaseURIback to summary
public void setBaseURI(String URI)

Implements abstract nu.xom.ParentNode.setBaseURI.

Sets the URI from which this element was loaded, and against which relative URLs in this element will be resolved, unless an xml:base attribute overrides this. Setting the base URI to null or the empty string removes any existing base URI.

Parameters
URI:String

the new base URI for this element

Exceptions
MalformedURIException:
if URI is not a legal RFC 3986 absolute URI
setLocalNameback to summary
public void setLocalName(String localName)

Sets the local name of this element.

Parameters
localName:String

the new local name

Exceptions
IllegalNameException:
if localName is not a legal, non-colonized name
setNamespacePrefixback to summary
public void setNamespacePrefix(String prefix)

Sets the namespace prefix of this element. You can pass null or the empty string to remove the prefix.

Parameters
prefix:String

the new namespace prefix

Exceptions
IllegalNameException:
if prefix is not a legal XML non-colonized name
NamespaceConflictException:
if prefix is already in use by an attribute or additional namespace with a different URI than the element itself
setNamespaceURIback to summary
public void setNamespaceURI(String uri)

Sets the namespace URI of this element.

Parameters
uri:String

the new namespace URI

Exceptions
MalformedURIException:
if uri is not an absolute RFC 3986 URI reference
NamespaceConflictException:
if this element has a prefix and uri is null or the empty string; or if the element's prefix is shared by an attribute or additional namespace
shallowCopyback to summary
protected Element shallowCopy()

Creates a very shallow copy of the element with the same name and namespace URI, but no children, attributes, base URI, or namespace declaration. This method is invoked as necessary by the copy method and the copy constructor.

Subclasses should override this method so that it returns an instance of the subclass so that types are preserved when copying. This method should not add any attributes, namespace declarations, or children to the shallow copy. Any such items will be overwritten.

Returns:Element

an empty element with the same name and namespace as this element

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this element suitable for debugging and diagnosis. This is not the XML representation of the element.

Returns:String

a non-XML string representation of this element

toXMLback to summary
public final String toXML()

Implements abstract nu.xom.Node.toXML.

Returns a string containing the XML serialization of this element. This includes the element and all its attributes and descendants. However, it does not contain namespace declarations for namespaces inherited from ancestor elements.

Returns:String

the XML representation of this element

writeEndTagback to summary
private static void writeEndTag(Element element, StringBuilder result)
writeStartTagback to summary
private static void writeStartTag(Element element, StringBuilder result)
nu.xom back to summary

private Class Element.AttributeIterator

extends Object
implements Iterator<Attribute>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public Attribute
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nextback to summary
private int next

Constructor Detail

AttributeIteratorback to summary
private AttributeIterator()

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

nextback to summary
public Attribute next() throws NoSuchElementException

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Attribute

the next element in the iteration

Exceptions
NoSuchElementException:
if the iteration has no more elements
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.