NameList
Stay organized with collections
Save and categorize content based on your preferences.
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.
Public Method Summary
abstract
boolean
|
|
abstract
boolean
|
|
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
public
abstract
boolean
contains
(String str)
Test if a name is part of this NameList
.
Parameters
str |
The name to look for. |
Returns
true
if the name has been found,
false
otherwise.
public
abstract
boolean
containsNS
(String namespaceURI, String name)
Test if the pair namespaceURI/name is part of this
NameList
.
Parameters
namespaceURI |
The namespace URI to look for. |
name |
The name to look for. |
Returns
true
if the pair namespaceURI/name has been
found, false
otherwise.
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.
public
abstract
String
getName
(int index)
Returns the index
th name item in the collection.
Parameters
index |
Index into the collection. |
Returns
- 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.
public
abstract
String
getNamespaceURI
(int index)
Returns the index
th namespaceURI item in the collection.
Parameters
index |
Index into the collection. |
Returns
- 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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eNameList\u003c/code\u003e is an interface representing an ordered collection of name and namespace pairs, accessible by index.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to check for the presence of a specific name (\u003ccode\u003econtains\u003c/code\u003e) or a name/namespace pair (\u003ccode\u003econtainsNS\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eNameList\u003c/code\u003e allows retrieval of the total number of pairs (\u003ccode\u003egetLength\u003c/code\u003e), a name at a specific index (\u003ccode\u003egetName\u003c/code\u003e), and its corresponding namespace URI (\u003ccode\u003egetNamespaceURI\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe index for accessing elements in the \u003ccode\u003eNameList\u003c/code\u003e starts from 0.\u003c/p\u003e\n"]]],[],null,["# NameList\n\npublic interface **NameList** \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\n### Public Method Summary\n\n|----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [contains](../../../../reference/org/w3c/dom/NameList.html#contains(java.lang.String))([String](../../../../reference/java/lang/String.html) str) Test if a name is part of this `NameList`. |\n| abstract boolean | [containsNS](../../../../reference/org/w3c/dom/NameList.html#containsNS(java.lang.String,%20java.lang.String))([String](../../../../reference/java/lang/String.html) namespaceURI, [String](../../../../reference/java/lang/String.html) name) Test if the pair namespaceURI/name is part of this `NameList`. |\n| abstract int | [getLength](../../../../reference/org/w3c/dom/NameList.html#getLength())() The number of pairs (name and namespaceURI) in the list. |\n| abstract [String](../../../../reference/java/lang/String.html) | [getName](../../../../reference/org/w3c/dom/NameList.html#getName(int))(int index) Returns the `index`th name item in the collection. |\n| abstract [String](../../../../reference/java/lang/String.html) | [getNamespaceURI](../../../../reference/org/w3c/dom/NameList.html#getNamespaceURI(int))(int index) Returns the `index`th namespaceURI item in the collection. |\n\nPublic Methods\n--------------\n\n#### public abstract boolean\n**contains**\n([String](../../../../reference/java/lang/String.html) str)\n\nTest if a name is part of this `NameList`. \n\n##### Parameters\n\n| str | The name to look for. |\n|-----|-----------------------|\n\n##### Returns\n\n- `true` if the name has been found, `false` otherwise. \n\n#### public abstract boolean\n**containsNS**\n([String](../../../../reference/java/lang/String.html) namespaceURI, [String](../../../../reference/java/lang/String.html) name)\n\nTest if the pair namespaceURI/name is part of this\n`NameList`. \n\n##### Parameters\n\n| namespaceURI | The namespace URI to look for. |\n| name | The name to look for. |\n|--------------|--------------------------------|\n\n##### Returns\n\n- `true` if the pair namespaceURI/name has been found, `false` otherwise. \n\n#### public abstract int\n**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#### public abstract [String](../../../../reference/java/lang/String.html)\n**getName**\n(int index)\n\nReturns the `index`th name item in the collection. \n\n##### Parameters\n\n| index | Index into the collection. |\n|-------|----------------------------|\n\n##### Returns\n\n- 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. \n\n#### public abstract [String](../../../../reference/java/lang/String.html)\n**getNamespaceURI**\n(int index)\n\nReturns the `index`th namespaceURI item in the collection. \n\n##### Parameters\n\n| index | Index into the collection. |\n|-------|----------------------------|\n\n##### Returns\n\n- 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."]]