Stay organized with collections
Save and categorize content based on your preferences.
NameList
public
interface
NameList
The NameList
interface provides the abstraction of an ordered
collection of parallel pairs of name and namespace values (which could be
null values), without defining or constraining how this collection is
implemented. The items in the NameList
are accessible via an
integral index, starting from 0.
See also the Document Object Model (DOM) Level 3 Core Specification.
Summary
Public methods |
abstract
boolean
|
contains(String str)
Test if a name is part of this NameList .
|
abstract
boolean
|
containsNS(String namespaceURI, String name)
Test if the pair namespaceURI/name is part of this
NameList .
|
abstract
int
|
getLength()
The number of pairs (name and namespaceURI) in the list.
|
abstract
String
|
getName(int index)
Returns the index th name item in the collection.
|
abstract
String
|
getNamespaceURI(int index)
Returns the index th namespaceURI item in the collection.
|
Public methods
contains
public abstract boolean contains (String str)
Test if a name is part of this NameList
.
Parameters |
str |
String : The name to look for. |
Returns |
boolean |
true if the name has been found,
false otherwise. |
containsNS
public abstract boolean containsNS (String namespaceURI,
String name)
Test if the pair namespaceURI/name is part of this
NameList
.
Parameters |
namespaceURI |
String : The namespace URI to look for. |
name |
String : The name to look for. |
Returns |
boolean |
true if the pair namespaceURI/name has been
found, false otherwise. |
getLength
public abstract int getLength ()
The number of pairs (name and namespaceURI) in the list. The range of
valid child node indices is 0 to length-1
inclusive.
getName
public abstract String getName (int index)
Returns the index
th name item in the collection.
Parameters |
index |
int : Index into the collection. |
Returns |
String |
The name at the index th position in the
NameList , or null if there is no name for
the specified index or if the index is out of range. |
getNamespaceURI
public abstract String getNamespaceURI (int index)
Returns the index
th namespaceURI item in the collection.
Parameters |
index |
int : Index into the collection. |
Returns |
String |
The namespace URI at the index th position in the
NameList , or null if there is no name for
the specified index or if the index is out of range. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# NameList\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nNameList\n========\n\n\n`\npublic\n\n\ninterface\nNameList\n`\n\n\n`\n\n\n`\n\n|----------------------|\n| org.w3c.dom.NameList |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThe `NameList` interface provides the abstraction of an ordered\ncollection of parallel pairs of name and namespace values (which could be\nnull values), without defining or constraining how this collection is\nimplemented. The items in the `NameList` are accessible via an\nintegral index, starting from 0.\n\nSee also the [Document Object Model (DOM) Level 3 Core Specification](http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407).\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[contains](/reference/org/w3c/dom/NameList#contains(java.lang.String))`(`[String](/reference/java/lang/String)` str) ` Test if a name is part of this `NameList`. |\n| ` abstract boolean` | ` `[containsNS](/reference/org/w3c/dom/NameList#containsNS(java.lang.String,%20java.lang.String))`(`[String](/reference/java/lang/String)` namespaceURI, `[String](/reference/java/lang/String)` name) ` Test if the pair namespaceURI/name is part of this `NameList`. |\n| ` abstract int` | ` `[getLength](/reference/org/w3c/dom/NameList#getLength())`() ` The number of pairs (name and namespaceURI) in the list. |\n| ` abstract `[String](/reference/java/lang/String) | ` `[getName](/reference/org/w3c/dom/NameList#getName(int))`(int index) ` Returns the `index`th name item in the collection. |\n| ` abstract `[String](/reference/java/lang/String) | ` `[getNamespaceURI](/reference/org/w3c/dom/NameList#getNamespaceURI(int))`(int index) ` Returns the `index`th namespaceURI item in the collection. |\n\nPublic methods\n--------------\n\n### contains\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean contains (String str)\n```\n\nTest if a name is part of this `NameList`.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------|----------------------------------------|\n| `str` | `String`: The name to look for. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------------------------------------------------------------|\n| `boolean` | `true` if the name has been found, `false` otherwise. \u003cbr /\u003e |\n\n### containsNS\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean containsNS (String namespaceURI, \n String name)\n```\n\nTest if the pair namespaceURI/name is part of this\n`NameList`.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------|-------------------------------------------------|\n| `namespaceURI` | `String`: The namespace URI to look for. \u003cbr /\u003e |\n| `name` | `String`: The name to look for. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------------------------------------------------------------------------------|\n| `boolean` | `true` if the pair namespaceURI/name has been found, `false` otherwise. \u003cbr /\u003e |\n\n### getLength\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract int getLength ()\n```\n\nThe number of pairs (name and namespaceURI) in the list. The range of\nvalid child node indices is 0 to `length-1` inclusive.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------|--------|\n| `int` | \u003cbr /\u003e |\n\n### getName\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract String getName (int index)\n```\n\nReturns the `index`th name item in the collection.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|------------------------------------------|\n| `index` | `int`: Index into the collection. \u003cbr /\u003e |\n\n| Returns ||\n|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [String](/reference/java/lang/String) | The name at the `index`th position in the `NameList`, or `null` if there is no name for the specified index or if the index is out of range. \u003cbr /\u003e |\n\n### getNamespaceURI\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract String getNamespaceURI (int index)\n```\n\nReturns the `index`th namespaceURI item in the collection.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|------------------------------------------|\n| `index` | `int`: Index into the collection. \u003cbr /\u003e |\n\n| Returns ||\n|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [String](/reference/java/lang/String) | The namespace URI at the `index`th position in the `NameList`, or `null` if there is no name for the specified index or if the index is out of range. \u003cbr /\u003e |"]]