# Titanium.XML.NamedNodeMap

> A key-value paired map that maps String objects to [Titanium.XML.Node](https://titaniumsdk.com/docs/sdk/Titanium.XML.Node.md) objects. Implements the [DOM Level 2 API](https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1780488922) on Android and iOS.

- Source: https://titaniumsdk.com/docs/sdk/13.1.0/Titanium.XML.NamedNodeMap
- Titanium SDK version: 13.1.0
- Kind: proxy
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK Android 0.9, iPhone 0.9, iPad 0.9, macOS 9.2.0
- Extends: Titanium.Proxy
- Inheritance: Titanium.Proxy

## Properties

### length

- Type: Number
- Platforms: Android, iPhone, iPad, macOS
- Permission: read-only

The number of nodes in the map. The valid range of child node indices is 0-`length`-1, inclusive.

## Methods

### getNamedItem

- Platforms: Android, iPhone, iPad, macOS

Retrieves a node specified by name.

Parameters:

- `name` (String): The name of the node to retrieve.

Returns: Titanium.XML.Node - The specified node, or `null` if no node with the name is in the map

### getNamedItemNS

- Platforms: Android, iPhone, iPad, macOS

Retrieves a node specified by name and namespace. Returns `null` if no matching node is in the map.

Parameters:

- `namespaceURI` (String): The namespace URI of the node to retrieve.
- `localName` (String): The local name of the node within the namespace to retrieve.

Returns: Titanium.XML.Node - The specified node, or `null` if there is no matching node.

### item

- Platforms: Android, iPhone, iPad, macOS

Retrieves the node at the specified index of the map. Note that NamedNodeMaps are not ordered.

Parameters:

- `index` (Number): The index of the node to retrieve.

Returns: Titanium.XML.Node - The node at the specified index, or `null` if the index is invalid

### removeNamedItem

- Platforms: Android, iPhone, iPad, macOS

Removes a node from the map specified by name. When this map contains attributes attached to an element, if the removed attribute is known to have a default, it is replaced with that value.

Parameters:

- `name` (String): The name of the node to remove.

Returns: Titanium.XML.Node - The node removed from the map, or `null` if nothing removed.

### removeNamedItemNS

- Platforms: Android, iPhone, iPad, macOS

Removes a node from the map specified by local name and namespace URI. When this map contains attributes attached to an element, if the removed attribute is known to have a default, it is replaced with that value. Returns the node removed from the map, or `null` if there is no corresponding node.

Parameters:

- `namespaceURI` (String): The namespace URI of the node to remove.
- `localName` (String): The local name of the node within the namespace to remove.

Returns: Titanium.XML.Node - The node removed from the map, or `null` if nothing removed.

### setNamedItem

- Platforms: Android, iPhone, iPad, macOS

Adds a node using its `nodeName` attribute. If a node with that name is already present, it is replaced. Throws an exception if the argument is from a different document, the map is read-only, or the argument is an attribute of another element.

Parameters:

- `node` (Titanium.XML.Node): The node to insert into the map.

Returns: Titanium.XML.Node - The node replaced, or `null` if no node was replaced.

### setNamedItemNS

- Platforms: Android, iPhone, iPad, macOS

Adds a node using its `namespaceURI` and `localName` attributes. If a node with that name is already present, it is replaced. Throws an exception if the argument is from a different document, the map is read-only, or the argument is an attribute of another element.

Parameters:

- `node` (Titanium.XML.Node): The node to insert into the map.

Returns: Titanium.XML.Node - Returns the node replaced, or `null`.

## Inherited members

7 members are inherited. Each is documented on the type that declares it.

- [Titanium.Proxy](https://titaniumsdk.com/docs/sdk/13.1.0/Titanium.Proxy.md): `addEventListener`, `apiName`, `applyProperties`, `bubbleParent`, `fireEvent`, `lifecycleContainer`, `removeEventListener`

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

