XML technologies / XML / XML in a Nutshell / DOM reference / Object reference / NameList

(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)

This interface provides a read-only, ordered list of name and namespace values accessible through a zero-based index.

 

Attributes

The object NameList has the following attributes:

 

length: unsigned long (3)

Returns the number of name/namespace pairs in the list. Read-only.

Java binding
public int getLength( );

 

Methods

The following methods are defined for this object:

 

contains: str (3)

Returns true, if the name specified by the parameter str is in the list. Otherwise, it returns false.

Argument

Java binding
public boolean contains(String str);

 

containsNS: namespaceURI, name (3)

Returns true, if the specified name/namespace pair is in the list. Otherwise, it returns false.

Argument

  • namespaceURI: DOMString

    The namespace URI of the name to search for.

  • name: DOMString

    The name value to search for.

Java binding
public boolean containsNS(String namespaceURI, String name);

 

getName: index (3)

Used to retrieve names from the list. Valid values for the argument index range from 0 through length – 1. If an invalid index is specified, the method returns null.

Argument

  • index: unsigned long

    The index of the name to retrieve.

Java binding
public String getName(int index);

 

getNamespaceURI: index (3)

Used to retrieve the namespace URI associated with a specified name in the list. Valid values for the argument index range from 0 through length – 1. If an invalid index is specified or the name has no associated namespace URI, this method returns null.

Argument

  • index: unsigned long

    The index of the name associated with the namespace URI to retrieve.

Java binding
public String getNamespaceURI(int index);

  

 

 

 

back to top