@ -12,117 +12,88 @@ import java.util.List;
import java.util.Map ;
import java.util.Map ;
/ * *
/ * *
* < p >
* < code > Element < / code > interface defines an XML element . An element can have
* < code > Element < / code > interface defines an XML element . An element can have
* declared namespaces , attributes , child nodes and textual content .
* declared namespaces , attributes , child nodes and textual content .
* < / p >
*
* < p >
* < p >
* Some of this interface is optional . Some implementations may be read - only and
* Some of this interface is optional . Some implementations may be read - only and
* not support being modified . Some implementations may not support the parent
* not support being modified . Some implementations may not support the parent
* relationship and methods such as { @link # getParent } or { @link # getDocument } .
* relationship and methods such as { @link # getParent } or { @link # getDocument } .
* < / p >
*
*
* @author < a href = "mailto:jstrachan@apache.org" > James Strachan < / a >
* @author < a href = "mailto:jstrachan@apache.org" > James Strachan < / a >
* @version $Revision$
* @version $Revision : 1 . 47 $
* /
* /
@SuppressWarnings ( "unused" )
public interface Element extends Branch {
public interface Element extends Branch {
// Name and namespace related methods
// Name and namespace related methods
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
/ * *
/ * *
* < p >
* Returns the < code > QName < / code > of this element which represents the
* Returns the < code > QName < / code > of this element which represents the
* local name , the qualified name and the < code > Namespace < / code > .
* local name , the qualified name and the < code > Namespace < / code > .
* < / p >
*
*
* @return the < code > QName < / code > associated with this element
* @return the < code > QName < / code > associated with this element
* /
* /
QName getQName ( ) ;
QName getQName ( ) ;
/ * *
/ * *
* < p >
* Sets the < code > QName < / code > of this element which represents the local
* Sets the < code > QName < / code > of this element which represents the local
* name , the qualified name and the < code > Namespace < / code > .
* name , the qualified name and the < code > Namespace < / code > .
* < / p >
*
*
* @param qname
* @param qname is the < code > QName < / code > to be associated with this element
* is the < code > QName < / code > to be associated with this element
* /
* /
void setQName ( QName qname ) ;
void setQName ( QName qname ) ;
/ * *
/ * *
* < p >
* Returns the < code > Namespace < / code > of this element if one exists
* Returns the < code > Namespace < / code > of this element if one exists
* otherwise < code > Namespace . NO_NAMESPACE < / code > is returned .
* otherwise < code > Namespace . NO_NAMESPACE < / code > is returned .
* < / p >
*
*
* @return the < code > Namespace < / code > associated with this element
* @return the < code > Namespace < / code > associated with this element
* /
* /
Namespace getNamespace ( ) ;
Namespace getNamespace ( ) ;
/ * *
/ * *
* < p >
* Returns the < code > QName < / code > for the given qualified name , using the
* Returns the < code > QName < / code > for the given qualified name , using the
* namespace URI in scope for the given prefix of the qualified name or the
* namespace URI in scope for the given prefix of the qualified name or the
* default namespace if the qualified name has no prefix .
* default namespace if the qualified name has no prefix .
* < / p >
*
* @param qualifiedName
* DOCUMENT ME !
*
*
* @param qualifiedName DOCUMENT ME !
* @return the < code > QName < / code > for the given qualified name
* @return the < code > QName < / code > for the given qualified name
* /
* /
QName getQName ( String qualifiedName ) ;
QName getQName ( String qualifiedName ) ;
/ * *
/ * *
* < p >
* Returns the < code > Namespace < / code > which is mapped to the given prefix
* Returns the < code > Namespace < / code > which is mapped to the given prefix
* or null if it could not be found .
* or null if it could not be found .
* < / p >
*
* @param prefix
* DOCUMENT ME !
*
*
* @param prefix DOCUMENT ME !
* @return the < code > Namespace < / code > associated with the given prefix
* @return the < code > Namespace < / code > associated with the given prefix
* /
* /
Namespace getNamespaceForPrefix ( String prefix ) ;
Namespace getNamespaceForPrefix ( String prefix ) ;
/ * *
/ * *
* < p >
* Returns the < code > Namespace < / code > which is mapped to the given URI or
* Returns the < code > Namespace < / code > which is mapped to the given URI or
* null if it could not be found . If there is more than one
* null if it could not be found . If there is more than one
* < code > Namespace < / code > mapped to the URI , which of them will be
* < code > Namespace < / code > mapped to the URI , which of them will be
* returned is undetermined .
* returned is undetermined .
* < / p >
*
* @param uri
* DOCUMENT ME !
*
*
* @param uri DOCUMENT ME !
* @return the < code > Namespace < / code > associated with the given URI
* @return the < code > Namespace < / code > associated with the given URI
* /
* /
Namespace getNamespaceForURI ( String uri ) ;
Namespace getNamespaceForURI ( String uri ) ;
/ * *
/ * *
* < p >
* Returns the all namespaces which are mapped to the given URI or an empty
* Returns the all namespaces which are mapped to the given URI or an empty
* list if no such namespaces could be found .
* list if no such namespaces could be found .
* < / p >
*
* @param uri
* DOCUMENT ME !
*
*
* @param uri DOCUMENT ME !
* @return the namespaces associated with the given URI
* @return the namespaces associated with the given URI
*
* @since 1 . 5
* @since 1 . 5
* /
* /
List getNamespacesForURI ( String uri ) ;
List < Namespace > getNamespacesForURI ( String uri ) ;
/ * *
/ * *
* < p >
* Returns the namespace prefix of this element if one exists otherwise an
* Returns the namespace prefix of this element if one exists otherwise an
* empty < code > String < / code > is returned .
* empty < code > String < / code > is returned .
* < / p >
*
*
* @return the prefix of the < code > Namespace < / code > of this element or an
* @return the prefix of the < code > Namespace < / code > of this element or an
* empty < code > String < / code >
* empty < code > String < / code >
@ -130,10 +101,8 @@ public interface Element extends Branch {
String getNamespacePrefix ( ) ;
String getNamespacePrefix ( ) ;
/ * *
/ * *
* < p >
* Returns the URI mapped to the namespace of this element if one exists
* Returns the URI mapped to the namespace of this element if one exists
* otherwise an empty < code > String < / code > is returned .
* otherwise an empty < code > String < / code > is returned .
* < / p >
*
*
* @return the URI for the < code > Namespace < / code > of this element or an
* @return the URI for the < code > Namespace < / code > of this element or an
* empty < code > String < / code >
* empty < code > String < / code >
@ -141,84 +110,66 @@ public interface Element extends Branch {
String getNamespaceURI ( ) ;
String getNamespaceURI ( ) ;
/ * *
/ * *
* < p >
* Returns the fully qualified name of this element . This will be the same
* Returns the fully qualified name of this element . This will be the same
* as the value returned from { @link # getName } if this element has no
* as the value returned from { @link # getName } if this element has no
* namespace attached to this element or an expression of the form
* namespace attached to this element or an expression of the form
*
* < pre >
* < pre >
* getNamespacePrefix ( ) + & quot ; : & quot ; + getName ( )
* getNamespacePrefix ( ) + & quot ; : & quot ; + getName ( )
* < / pre >
* < / pre >
*
* will be returned .
* will be returned .
* < / p >
*
*
* @return the fully qualified name of the element .
* @return the fully qualified name of the element .
* /
* /
String getQualifiedName ( ) ;
String getQualifiedName ( ) ;
/ * *
/ * *
* < p >
* Returns any additional namespaces declarations for this element other
* Returns any additional namespaces declarations for this element other
* than namespace returned via the { @link # getNamespace ( ) } method . If no
* than namespace returned via the { @link # getNamespace ( ) } method . If no
* additional namespace declarations are present for this element then an
* additional namespace declarations are present for this element then an
* empty list will be returned . The list is backed by the element such that
* empty list will be returned . The list is backed by the element such that
* changes to the list will be reflected in the element though the reverse
* changes to the list will be reflected in the element though the reverse
* is not the case .
* is not the case .
* < / p >
*
*
* @return a list of any additional namespace declarations .
* @return a list of any additional namespace declarations .
* /
* /
List additionalNamespaces ( ) ;
List < Namespace > additionalNamespaces ( ) ;
/ * *
/ * *
* < p >
* Returns all the namespaces declared by this element . If no namespaces are
* Returns all the namespaces declared by this element . If no namespaces are
* declared for this element then an empty list will be returned . The list
* declared for this element then an empty list will be returned . The list
* is backed by the element such that changes to the list will be reflected
* is backed by the element such that changes to the list will be reflected
* in the element though the reverse is not the case .
* in the element though the reverse is not the case .
* < / p >
*
*
* @return a list of namespaces declared for this element .
* @return a list of namespaces declared for this element .
* /
* /
List declaredNamespaces ( ) ;
List < Namespace > declaredNamespaces ( ) ;
// Builder methods
// Builder methods
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
/ * *
/ * *
* < p >
* Adds the attribute value of the given local name . If an attribute already
* Adds the attribute value of the given local name . If an attribute already
* exists for the given name it will be replaced . Attributes with null
* exists for the given name it will be replaced . Attributes with null
* values are silently ignored . If the value of the attribute is null then
* values are silently ignored . If the value of the attribute is null then
* this method call will remove any attributes with the given name .
* this method call will remove any attributes with the given name .
* < / p >
*
*
* @param name
* @param name is the name of the attribute whose value is to be added or
* is the name of the attribute whose value is to be added or
* updated
* updated
* @param value
* @param value is the attribute ' s value
* is the attribute ' s value
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addAttribute ( String name , String value ) ;
Element addAttribute ( String name , String value ) ;
/ * *
/ * *
* < p >
* Adds the attribute value of the given fully qualified name . If an
* Adds the attribute value of the given fully qualified name . If an
* attribute already exists for the given name it will be replaced .
* attribute already exists for the given name it will be replaced .
* Attributes with null values are silently ignored . If the value of the
* Attributes with null values are silently ignored . If the value of the
* attribute is null then this method call will remove any attributes with
* attribute is null then this method call will remove any attributes with
* the given name .
* the given name .
* < / p >
*
*
* @param qName
* @param qName is the fully qualified name of the attribute whose value is to
* is the fully qualified name of the attribute whose value is to
* be added or updated
* be added or updated
* @param value
* @param value is the attribute ' s value
* is the attribute ' s value
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addAttribute ( QName qName , String value ) ;
Element addAttribute ( QName qName , String value ) ;
@ -227,9 +178,7 @@ public interface Element extends Branch {
* Adds a new < code > Comment < / code > node with the given text to this
* Adds a new < code > Comment < / code > node with the given text to this
* element .
* element .
*
*
* @param comment
* @param comment is the text for the < code > Comment < / code > node .
* is the text for the < code > Comment < / code > node .
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addComment ( String comment ) ;
Element addComment ( String comment ) ;
@ -237,9 +186,7 @@ public interface Element extends Branch {
/ * *
/ * *
* Adds a new < code > CDATA < / code > node with the given text to this element .
* Adds a new < code > CDATA < / code > node with the given text to this element .
*
*
* @param cdata
* @param cdata is the text for the < code > CDATA < / code > node .
* is the text for the < code > CDATA < / code > node .
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addCDATA ( String cdata ) ;
Element addCDATA ( String cdata ) ;
@ -248,11 +195,8 @@ public interface Element extends Branch {
* Adds a new < code > Entity < / code > node with the given name and text to
* Adds a new < code > Entity < / code > node with the given name and text to
* this element and returns a reference to the new node .
* this element and returns a reference to the new node .
*
*
* @param name
* @param name is the name for the < code > Entity < / code > node .
* is the name for the < code > Entity < / code > node .
* @param text is the text for the < code > Entity < / code > node .
* @param text
* is the text for the < code > Entity < / code > node .
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addEntity ( String name , String text ) ;
Element addEntity ( String name , String text ) ;
@ -260,11 +204,8 @@ public interface Element extends Branch {
/ * *
/ * *
* Adds a namespace to this element for use by its child content
* Adds a namespace to this element for use by its child content
*
*
* @param prefix
* @param prefix is the prefix to use , which should not be null or blank
* is the prefix to use , which should not be null or blank
* @param uri is the namespace URI
* @param uri
* is the namespace URI
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addNamespace ( String prefix , String uri ) ;
Element addNamespace ( String prefix , String uri ) ;
@ -272,12 +213,9 @@ public interface Element extends Branch {
/ * *
/ * *
* Adds a processing instruction for the given target
* Adds a processing instruction for the given target
*
*
* @param target
* @param target is the target of the processing instruction
* is the target of the processing instruction
* @param text is the textual data ( key / value pairs ) of the processing
* @param text
* is the textual data ( key / value pairs ) of the processing
* instruction
* instruction
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addProcessingInstruction ( String target , String text ) ;
Element addProcessingInstruction ( String target , String text ) ;
@ -285,22 +223,17 @@ public interface Element extends Branch {
/ * *
/ * *
* Adds a processing instruction for the given target
* Adds a processing instruction for the given target
*
*
* @param target
* @param target is the target of the processing instruction
* is the target of the processing instruction
* @param data is a Map of the key / value pairs of the processing
* @param data
* is a Map of the key / value pairs of the processing
* instruction
* instruction
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addProcessingInstruction ( String target , Map data ) ;
Element addProcessingInstruction ( String target , Map < String , String > data ) ;
/ * *
/ * *
* Adds a new < code > Text < / code > node with the given text to this element .
* Adds a new < code > Text < / code > node with the given text to this element .
*
*
* @param text
* @param text is the text for the < code > Text < / code > node .
* is the text for the < code > Text < / code > node .
*
* @return this < code > Element < / code > instance .
* @return this < code > Element < / code > instance .
* /
* /
Element addText ( String text ) ;
Element addText ( String text ) ;
@ -314,13 +247,10 @@ public interface Element extends Branch {
* < code > IllegalAddException < / code > will be thrown . Attributes with null
* < code > IllegalAddException < / code > will be thrown . Attributes with null
* values are silently ignored .
* values are silently ignored .
*
*
* < p >
* If the value of the attribute is null then this method call will remove
* If the value of the attribute is null then this method call will remove
* any attributes with the QName of this attribute .
* any attributes with the QName of this attribute .
* < / p >
*
*
* @param attribute
* @param attribute is the attribute to be added
* is the attribute to be added
* /
* /
void add ( Attribute attribute ) ;
void add ( Attribute attribute ) ;
@ -329,8 +259,7 @@ public interface Element extends Branch {
* already has a parent defined then an < code > IllegalAddException < / code >
* already has a parent defined then an < code > IllegalAddException < / code >
* will be thrown .
* will be thrown .
*
*
* @param cdata
* @param cdata is the CDATA to be added
* is the CDATA to be added
* /
* /
void add ( CDATA cdata ) ;
void add ( CDATA cdata ) ;
@ -339,8 +268,7 @@ public interface Element extends Branch {
* already has a parent defined then an < code > IllegalAddException < / code >
* already has a parent defined then an < code > IllegalAddException < / code >
* will be thrown .
* will be thrown .
*
*
* @param entity
* @param entity is the entity to be added
* is the entity to be added
* /
* /
void add ( Entity entity ) ;
void add ( Entity entity ) ;
@ -349,8 +277,7 @@ public interface Element extends Branch {
* already has a parent defined then an < code > IllegalAddException < / code >
* already has a parent defined then an < code > IllegalAddException < / code >
* will be thrown .
* will be thrown .
*
*
* @param text
* @param text is the text to be added
* is the text to be added
* /
* /
void add ( Text text ) ;
void add ( Text text ) ;
@ -359,17 +286,14 @@ public interface Element extends Branch {
* node already has a parent defined then an
* node already has a parent defined then an
* < code > IllegalAddException < / code > will be thrown .
* < code > IllegalAddException < / code > will be thrown .
*
*
* @param namespace
* @param namespace is the namespace to be added
* is the namespace to be added
* /
* /
void add ( Namespace namespace ) ;
void add ( Namespace namespace ) ;
/ * *
/ * *
* Removes the given < code > Attribute < / code > from this element .
* Removes the given < code > Attribute < / code > from this element .
*
*
* @param attribute
* @param attribute is the attribute to be removed
* is the attribute to be removed
*
* @return true if the attribute was removed
* @return true if the attribute was removed
* /
* /
boolean remove ( Attribute attribute ) ;
boolean remove ( Attribute attribute ) ;
@ -379,9 +303,7 @@ public interface Element extends Branch {
* of this element . If the given node is not an immediate child of this
* of this element . If the given node is not an immediate child of this
* element then the { @link Node # detach ( ) } method should be used instead .
* element then the { @link Node # detach ( ) } method should be used instead .
*
*
* @param cdata
* @param cdata is the CDATA to be removed
* is the CDATA to be removed
*
* @return true if the cdata was removed
* @return true if the cdata was removed
* /
* /
boolean remove ( CDATA cdata ) ;
boolean remove ( CDATA cdata ) ;
@ -391,9 +313,7 @@ public interface Element extends Branch {
* of this element . If the given node is not an immediate child of this
* of this element . If the given node is not an immediate child of this
* element then the { @link Node # detach ( ) } method should be used instead .
* element then the { @link Node # detach ( ) } method should be used instead .
*
*
* @param entity
* @param entity is the entity to be removed
* is the entity to be removed
*
* @return true if the entity was removed
* @return true if the entity was removed
* /
* /
boolean remove ( Entity entity ) ;
boolean remove ( Entity entity ) ;
@ -404,9 +324,7 @@ public interface Element extends Branch {
* this element then the { @link Node # detach ( ) } method should be used
* this element then the { @link Node # detach ( ) } method should be used
* instead .
* instead .
*
*
* @param namespace
* @param namespace is the namespace to be removed
* is the namespace to be removed
*
* @return true if the namespace was removed
* @return true if the namespace was removed
* /
* /
boolean remove ( Namespace namespace ) ;
boolean remove ( Namespace namespace ) ;
@ -416,9 +334,7 @@ public interface Element extends Branch {
* of this element . If the given node is not an immediate child of this
* of this element . If the given node is not an immediate child of this
* element then the { @link Node # detach ( ) } method should be used instead .
* element then the { @link Node # detach ( ) } method should be used instead .
*
*
* @param text
* @param text is the text to be removed
* is the text to be removed
*
* @return true if the text was removed
* @return true if the text was removed
* /
* /
boolean remove ( Text text ) ;
boolean remove ( Text text ) ;
@ -470,8 +386,7 @@ public interface Element extends Branch {
* Sets the data value of this element if this element supports data binding
* Sets the data value of this element if this element supports data binding
* or calls { @link # setText } if it doesn ' t
* or calls { @link # setText } if it doesn ' t
*
*
* @param data
* @param data DOCUMENT ME !
* DOCUMENT ME !
* /
* /
void setData ( Object data ) ;
void setData ( Object data ) ;
@ -479,25 +394,22 @@ public interface Element extends Branch {
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
/ * *
/ * *
* < p >
* Returns the { @link Attribute } instances this element contains as a backed
* Returns the { @link Attribute } instances this element contains as a backed
* { @link List } so that the attributes may be modified directly using the
* { @link List } so that the attributes may be modified directly using the
* { @link List } interface . The < code > List < / code > is backed by the
* { @link List } interface . The < code > List < / code > is backed by the
* < code > Element < / code > so that changes to the list are reflected in the
* < code > Element < / code > so that changes to the list are reflected in the
* element and vice versa .
* element and vice versa .
* < / p >
*
*
* @return the attributes that this element contains as a < code > List < / code >
* @return the attributes that this element contains as a < code > List < / code >
* /
* /
List attributes ( ) ;
List < Attribute > attributes ( ) ;
/ * *
/ * *
* Sets the attributes that this element contains
* Sets the attributes that this element contains
*
*
* @param attributes
* @param attributes DOCUMENT ME !
* DOCUMENT ME !
* /
* /
void setAttributes ( List attributes ) ;
void setAttributes ( List < Attribute > attributes ) ;
/ * *
/ * *
* DOCUMENT ME !
* DOCUMENT ME !
@ -511,14 +423,12 @@ public interface Element extends Branch {
*
*
* @return an iterator over the attributes of this element
* @return an iterator over the attributes of this element
* /
* /
Iterator attributeIterator ( ) ;
Iterator < Attribute > attributeIterator ( ) ;
/ * *
/ * *
* Returns the attribute at the specified indexGets the
* Returns the attribute at the specified indexGets the
*
*
* @param index
* @param index DOCUMENT ME !
* DOCUMENT ME !
*
* @return the attribute at the specified index where index & gt ; = 0 and
* @return the attribute at the specified index where index & gt ; = 0 and
* index & lt ; number of attributes or throws an
* index & lt ; number of attributes or throws an
* IndexOutOfBoundsException if the index is not within the
* IndexOutOfBoundsException if the index is not within the
@ -529,9 +439,7 @@ public interface Element extends Branch {
/ * *
/ * *
* Returns the attribute with the given name
* Returns the attribute with the given name
*
*
* @param name
* @param name DOCUMENT ME !
* DOCUMENT ME !
*
* @return the attribute for the given local name in any namespace . If there
* @return the attribute for the given local name in any namespace . If there
* are more than one attributes with the given local name in
* are more than one attributes with the given local name in
* different namespaces then the first one is returned .
* different namespaces then the first one is returned .
@ -541,109 +449,79 @@ public interface Element extends Branch {
/ * *
/ * *
* DOCUMENT ME !
* DOCUMENT ME !
*
*
* @param qName
* @param qName is the fully qualified name
* is the fully qualified name
*
* @return the attribute for the given fully qualified name or null if it
* @return the attribute for the given fully qualified name or null if it
* could not be found .
* could not be found .
* /
* /
Attribute attribute ( QName qName ) ;
Attribute attribute ( QName qName ) ;
/ * *
/ * *
* < p >
* This returns the attribute value for the attribute with the given name
* This returns the attribute value for the attribute with the given name
* and any namespace or null if there is no such attribute or the empty
* and any namespace or null if there is no such attribute or the empty
* string if the attribute value is empty .
* string if the attribute value is empty .
* < / p >
*
* @param name
* is the name of the attribute value to be returnd
*
*
* @param name is the name of the attribute value to be returned
* @return the value of the attribute , null if the attribute does not exist
* @return the value of the attribute , null if the attribute does not exist
* or the empty string
* or the empty string
* /
* /
String attributeValue ( String name ) ;
String attributeValue ( String name ) ;
/ * *
/ * *
* < p >
* This returns the attribute value for the attribute with the given name
* This returns the attribute value for the attribute with the given name
* and any namespace or the default value if there is no such attribute
* and any namespace or the default value if there is no such attribute
* value .
* value .
* < / p >
*
*
* @param name
* @param name is the name of the attribute value to be returned
* is the name of the attribute value to be returnd
* @param defaultValue is the default value to be returned if the attribute has no
* @param defaultValue
* is the default value to be returned if the attribute has no
* value defined .
* value defined .
*
* @return the value of the attribute or the defaultValue if the attribute
* @return the value of the attribute or the defaultValue if the attribute
* has no value defined .
* has no value defined .
* /
* /
String attributeValue ( String name , String defaultValue ) ;
String attributeValue ( String name , String defaultValue ) ;
/ * *
/ * *
* < p >
* This returns the attribute value for the attribute with the given fully
* This returns the attribute value for the attribute with the given fully
* qualified name or null if there is no such attribute or the empty string
* qualified name or null if there is no such attribute or the empty string
* if the attribute value is empty .
* if the attribute value is empty .
* < / p >
*
* @param qName
* is the fully qualified name
*
*
* @param qName is the fully qualified name
* @return the value of the attribute , null if the attribute does not exist
* @return the value of the attribute , null if the attribute does not exist
* or the empty string
* or the empty string
* /
* /
String attributeValue ( QName qName ) ;
String attributeValue ( QName qName ) ;
/ * *
/ * *
* < p >
* This returns the attribute value for the attribute with the given fully
* This returns the attribute value for the attribute with the given fully
* qualified name or the default value if there is no such attribute value .
* qualified name or the default value if there is no such attribute value .
* < / p >
*
*
* @param qName
* @param qName is the fully qualified name
* is the fully qualified name
* @param defaultValue is the default value to be returned if the attribute has no
* @param defaultValue
* is the default value to be returned if the attribute has no
* value defined .
* value defined .
*
* @return the value of the attribute or the defaultValue if the attribute
* @return the value of the attribute or the defaultValue if the attribute
* has no value defined .
* has no value defined .
* /
* /
String attributeValue ( QName qName , String defaultValue ) ;
String attributeValue ( QName qName , String defaultValue ) ;
/ * *
/ * *
* < p >
* Sets the attribute value of the given local name .
* Sets the attribute value of the given local name .
* < / p >
*
*
* @param name
* @param name is the name of the attribute whose value is to be added or
* is the name of the attribute whose value is to be added or
* updated
* updated
* @param value
* @param value is the attribute ' s value
* is the attribute ' s value
*
* @deprecated As of version 0 . 5 . Please use { @link
* @deprecated As of version 0 . 5 . Please use { @link
* # addAttribute ( String , String ) } instead . WILL BE REMOVED IN
* # addAttribute ( String , String ) } instead . WILL BE REMOVED IN
* dom4j - 1 . 6 ! !
* dom4j - 1 . 6 ! !
* /
* /
void setAttributeValue ( String name , String value ) ;
void setAttributeValue ( String name , String value ) ;
/ * *
/ * *
* < p >
* Sets the attribute value of the given fully qualified name .
* Sets the attribute value of the given fully qualified name .
* < / p >
*
*
* @param qName
* @param qName is the fully qualified name of the attribute whose value is to
* is the fully qualified name of the attribute whose value is to
* be added or updated
* be added or updated
* @param value
* @param value is the attribute ' s value
* is the attribute ' s value
*
* @deprecated As of version 0 . 5 . Please use { @link
* @deprecated As of version 0 . 5 . Please use { @link
* # addAttribute ( QName , String ) } instead . WILL BE REMOVED IN
* # addAttribute ( QName , String ) } instead . WILL BE REMOVED IN
* dom4j - 1 . 6 ! !
* dom4j - 1 . 6 ! !
* /
* /
void setAttributeValue ( QName qName , String value ) ;
void setAttributeValue ( QName qName , String value ) ;
@ -654,9 +532,7 @@ public interface Element extends Branch {
/ * *
/ * *
* Returns the first element for the given local name and any namespace .
* Returns the first element for the given local name and any namespace .
*
*
* @param name
* @param name DOCUMENT ME !
* DOCUMENT ME !
*
* @return the first element with the given local name
* @return the first element with the given local name
* /
* /
Element element ( String name ) ;
Element element ( String name ) ;
@ -664,87 +540,71 @@ public interface Element extends Branch {
/ * *
/ * *
* Returns the first element for the given fully qualified name .
* Returns the first element for the given fully qualified name .
*
*
* @param qName
* @param qName is the fully qualified name to search for
* is the fully qualified name to search for
*
* @return the first element with the given fully qualified name
* @return the first element with the given fully qualified name
* /
* /
Element element ( QName qName ) ;
Element element ( QName qName ) ;
/ * *
/ * *
* < p >
* Returns the elements contained in this element . If this element does not
* Returns the elements contained in this element . If this element does not
* contain any elements then this method returns an empty list . The list is
* contain any elements then this method returns an empty list . The list is
* backed by the element such that changes to the list will be reflected in
* backed by the element such that changes to the list will be reflected in
* the element though the reverse is not the case .
* the element though the reverse is not the case .
* < / p >
*
*
* @return a list of all the elements in this element .
* @return a list of all the elements in this element .
* /
* /
List elements ( ) ;
List < Element > elements ( ) ;
/ * *
/ * *
* < p >
* Returns the elements contained in this element with the given local name
* Returns the elements contained in this element with the given local name
* and any namespace . If no elements are found then this method returns an
* and any namespace . If no elements are found then this method returns an
* empty list . The list is backed by the element such that changes to the
* empty list . The list is backed by the element such that changes to the
* list will be reflected in the element though the reverse is not the case .
* list will be reflected in the element though the reverse is not the case .
* < / p >
*
* @param name
* DOCUMENT ME !
*
*
* @param name DOCUMENT ME !
* @return a list of all the elements in this element for the given local
* @return a list of all the elements in this element for the given local
* name
* name
* /
* /
List elements ( String name ) ;
List < Element > elements ( String name ) ;
/ * *
/ * *
* < p >
* Returns the elements contained in this element with the given fully
* Returns the elements contained in this element with the given fully
* qualified name . If no elements are found then this method returns an
* qualified name . If no elements are found then this method returns an
* empty list . The list is backed by the element such that changes to the
* empty list . The list is backed by the element such that changes to the
* list will be reflected in the element though the reverse is not the case .
* list will be reflected in the element though the reverse is not the case .
* < / p >
*
* @param qName
* is the fully qualified name to search for
*
*
* @param qName is the fully qualified name to search for
* @return a list of all the elements in this element for the given fully
* @return a list of all the elements in this element for the given fully
* qualified name .
* qualified name .
* /
* /
List elements ( QName qName ) ;
List < Element > elements ( QName qName ) ;
/ * *
/ * *
* Returns an iterator over all this elements child elements .
* Returns an iterator over all this elements child elements .
*
*
* @return an iterator over the contained elements
* @return an iterator over the contained elements
* /
* /
Iterator elementIterator ( ) ;
Iterator < Element > elementIterator ( ) ;
/ * *
/ * *
* Returns an iterator over the elements contained in this element which
* Returns an iterator over the elements contained in this element which
* match the given local name and any namespace .
* match the given local name and any namespace .
*
*
* @param name
* @param name DOCUMENT ME !
* DOCUMENT ME !
*
* @return an iterator over the contained elements matching the given local
* @return an iterator over the contained elements matching the given local
* name
* name
* /
* /
Iterator elementIterator ( String name ) ;
Iterator < Element > elementIterator ( String name ) ;
/ * *
/ * *
* Returns an iterator over the elements contained in this element which
* Returns an iterator over the elements contained in this element which
* match the given fully qualified name .
* match the given fully qualified name .
*
*
* @param qName
* @param qName is the fully qualified name to search for
* is the fully qualified name to search for
*
* @return an iterator over the contained elements matching the given fully
* @return an iterator over the contained elements matching the given fully
* qualified name
* qualified name
* /
* /
Iterator elementIterator ( QName qName ) ;
Iterator < Element > elementIterator ( QName qName ) ;
// Helper methods
// Helper methods
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
@ -758,20 +618,16 @@ public interface Element extends Branch {
boolean isRootElement ( ) ;
boolean isRootElement ( ) ;
/ * *
/ * *
* < p >
* Returns true if this < code > Element < / code > has mixed content . Mixed
* Returns true if this < code > Element < / code > has mixed content . Mixed
* content means that an element contains both textual data and child
* content means that an element contains both textual data and child
* elements .
* elements .
* < / p >
*
*
* @return true if this element contains mixed content .
* @return true if this element contains mixed content .
* /
* /
boolean hasMixedContent ( ) ;
boolean hasMixedContent ( ) ;
/ * *
/ * *
* < p >
* Returns true if this < code > Element < / code > has text only content .
* Returns true if this < code > Element < / code > has text only content .
* < / p >
*
*
* @return true if this element is empty or only contains text content .
* @return true if this element is empty or only contains text content .
* /
* /
@ -782,45 +638,34 @@ public interface Element extends Branch {
* like the { @link java . util . Collection # addAll ( java . util . Collection ) }
* like the { @link java . util . Collection # addAll ( java . util . Collection ) }
* method .
* method .
*
*
* @param element
* @param element is the element whose attributes will be added to me .
* is the element whose attributes will be added to me .
* /
* /
void appendAttributes ( Element element ) ;
void appendAttributes ( Element element ) ;
/ * *
/ * *
* < p >
* Creates a deep copy of this element The new element is detached from its
* Creates a deep copy of this element The new element is detached from its
* parent , and getParent ( ) on the clone will return null .
* parent , and getParent ( ) on the clone will return null .
* < / p >
*
*
* @return a new deep copy Element
* @return a new deep copy Element
* /
* /
Element createCopy ( ) ;
Element createCopy ( ) ;
/ * *
/ * *
* < p >
* Creates a deep copy of this element with the given local name The new
* Creates a deep copy of this element with the given local name The new
* element is detached from its parent , and getParent ( ) on the clone will
* element is detached from its parent , and getParent ( ) on the clone will
* return null .
* return null .
* < / p >
*
* @param name
* DOCUMENT ME !
*
*
* @param name DOCUMENT ME !
* @return a new deep copy Element
* @return a new deep copy Element
* /
* /
Element createCopy ( String name ) ;
Element createCopy ( String name ) ;
/ * *
/ * *
* < p >
* Creates a deep copy of this element with the given fully qualified name .
* Creates a deep copy of this element with the given fully qualified name .
* The new element is detached from its parent , and getParent ( ) on the clone
* The new element is detached from its parent , and getParent ( ) on the clone
* will return null .
* will return null .
* < / p >
*
* @param qName
* DOCUMENT ME !
*
*
* @param qName DOCUMENT ME !
* @return a new deep copy Element
* @return a new deep copy Element
* /
* /
Element createCopy ( QName qName ) ;
Element createCopy ( QName qName ) ;
@ -838,9 +683,7 @@ public interface Element extends Branch {
* means the resulting Node will either be null or it will support the
* means the resulting Node will either be null or it will support the
* parent relationship .
* parent relationship .
*
*
* @param index
* @param index DOCUMENT ME !
* DOCUMENT ME !
*
* @return the Node for the given index which will support the parent
* @return the Node for the given index which will support the parent
* relationship or null if there is not a node at the given index .
* relationship or null if there is not a node at the given index .
* /
* /