Skip Headers

Oracle® XML API Reference 10g Release 1 (10.1) Part No. B10789-01 |
| Contents

## NamedNodeMap Interface

Table 4-7 summarizes the methods of available through the `NamedNodeMap` interface.

Table 4-7 Summary of NamedNodeMap Methods; DOM Package

Function | Summary
--- | ---
XmlDomGetNamedItem | Return named node from list.
XmlDomGetNamedItemNS | Return named node from list (namespace aware version).
XmlDomGetNodeMapItem | Return nth node in list.
XmlDomGetNodeMapLength | Return length of named node map.
XmlDomRemoveNamedItem | Remove node from named node map.
XmlDomRemoveNamedItemNS | Remove node from named node map (namespace aware version).
XmlDomSetNamedItem | Set node in named node list.
XmlDomSetNamedItemNS | Set node in named node list (namespace aware version).

### XmlDomGetNamedItem

Retrieves an item from a `NamedNodeMap`, specified by name (which should be in the data encoding). This is a non-namespace-aware function; it just matches (case sensitively) on the whole qualified name. Note this function differs from the DOM spec in that the index of the matching item is also returned.

Syntax

    xmlnode* XmlDomGetNamedItem(
       xmlctx *xctx,
       xmlnamedmap *map,
       oratext *name)

Parameter | In/Out | Description
--- | --- | ---
    xctx
    IN
| XML context
    map
    IN
| `NamedNodeMap`
    name
    IN
| name of the node to retrieve

Returns

`(xmlnode *)` `Node` with the specified name [or `NULL`]

See Also: XmlDomGetNamedItemNS, XmlDomGetNodeMapItem, XmlDomGetNodeMapLength

### XmlDomGetNamedItemNS

Retrieves an item from a `NamedNodeMap`, specified by URI and localname (which should be in the data encoding). Note this function differs from the DOM spec in that the index of the matching item is also returned.

Syntax

    xmlnode* XmlDomGetNamedItemNS(
       xmlctx *xctx,
       xmlnamedmap *map,
       oratext *uri,
       oratext *local)

Parameter | In/Out | Description
--- | --- | ---
    xctx
    IN
| XML context
    map
    IN
| `NamedNodeMap`
    uri
    IN
| namespace URI of the node to retrieve; data encoding
    local
    IN
| local name of the node to retrieve; data encoding

Returns

`(xmlnode *)` node with given local name and namespace URI [or `NULL`]

See Also: XmlDomGetNamedItem, XmlDomGetNodeMapItem, XmlDomGetNodeMapLength

### XmlDomGetNodeMapItem

Retrieves an item from a `NamedNodeMap`, specified by name (which should be in the data encoding). This is a non-namespace-aware function; it just matches (case sensitively) on the whole qualified name. Note this function differs from the DOM specification in that the index of the matching item is also returned. Named "item" in W3C specification.

Syntax

    xmlnode* XmlDomGetNodeMapItem(
       xmlctx *xctx,
       xmlnamedmap *map,
       ub4 index)

Parameter | In/Out | Description
--- | --- | ---
    xctx
    IN
| XML context
    map
    IN
| `NamedNodeMap`
    index
    IN
| `0`-based index for the map

Returns

`(xmlnode *)` node at the nth position in the map (or `NULL`)

See Also: XmlDomGetNamedItem, XmlDomSetNamedItem, XmlDomRemoveNamedItem, XmlDomGetNodeMapLength

### XmlDomGetNodeMapLength

Returns the number of nodes in a `NamedNodeMap` (the length). Note that nodes are referred to by index, and the range of valid indexes is `0` through length-1.

Syntax

    ub4 XmlDomGetNodeMapLength(
       xmlctx *xctx,
       xmlnamedmap *map)

Parameter | In/Out | Description
--- | --- | ---
    xctx
    IN
| XML context
    map
    IN
| `NamedNodeMap`

Returns

`(ub4)` number of nodes in `NamedNodeMap`

See Also: XmlDomGetNodeMapItem, XmlDomGetNamedItem

### XmlDomRemoveNamedItem

Removes a node from a `NamedNodeMap`, specified by name. This is a non-namespace-aware function; it just matches (case sensitively) on the whole qualified name. If the removed node is an attribute with default value (not specified), it is immediately replaced. The removed node is returned; if no removal took place, `NULL` is returned.

Syntax

    xmlnode* XmlDomRemoveNamedItem(
       xmlctx *xctx,
       xmlnamedmap *map,
       oratext *name)

Parameter | In/Out | Description
--- | --- | ---
    xctx
    IN
| XML context
    map
    IN
| `NamedNodeMap`
    name
    IN
| name of node to remove

Returns

`(xmlnode *)` node removed from this map

See Also: XmlDomRemoveNamedItemNS, XmlDomGetNamedItem, XmlDomGetNamedItemNS, XmlDomSetNamedItem, XmlDomSetNamedItemNS

### XmlDomRemoveNamedItemNS

Removes a node from a `NamedNodeMap`, specified by URI and localname. If the removed node is an attribute with default value (not specified), it is immediately replaced. The removed node is returned; if no removal took place, `NULL` is returned.

Syntax

    xmlnode* XmlDomRemoveNamedItemNS(
       xmlctx *xctx,
       xmlnamedmap *map,
       oratext *uri,
       oratext *local)

Parameter | In/Out | Description
--- | --- | ---
    xctx
    IN
| XML context
    map
    IN
| `NamedNodeMap`
    uri
    IN
| namespace URI of the node to remove; data encoding
    local
    IN
| local name of the node to remove; data encoding

Returns

`(xmlnode *)` node removed from this map

See Also: XmlDomRemoveNamedItem, XmlDomGetNamedItem, XmlDomGetNamedItemNS, XmlDomSetNamedItem, XmlDomSetNamedItemNS

### XmlDomSetNamedItem

Adds a new node to a `NamedNodeMap`. If a node already exists with the given name, replaces the old node and returns it. If no such named node exists, adds the new node to the map and sets old to `NULL`. This is a non-namespace-aware function; it just matches (case sensitively) on the whole qualified name. Since some node types have fixed names (`Text`, `Comment`, and so on), trying to set another of the same type will always cause replacement.

Syntax

    xmlnode* XmlDomSetNamedItem(
       xmlctx *xctx,
       xmlnamedmap *map,
       xmlnode *newNode)

Parameter | In/Out | Description
--- | --- | ---
    xctx
    IN
| XML context
    map
    IN
| `NamedNodeMap`
    newNode
    IN
| new node to store in map

Returns

`(xmlnode *)` the replaced node (or `NULL`)

See Also: XmlDomSetNamedItemNS, XmlDomGetNamedItem, XmlDomGetNamedItemNS, XmlDomGetNodeMapItem, XmlDomGetNodeMapLength

### XmlDomSetNamedItemNS

Adds a new node to a `NamedNodeMap`. If a node already exists with the given URI and localname, replaces the old node and returns it. If no such named node exists, adds the new node to the map and sets old to `NULL`. Since some node types have fixed names (`Text`, `Comment`, and so on), trying to set another of the same type will always cause replacement.

Syntax

    xmlnode* XmlDomSetNamedItemNS(
       xmlctx *xctx,
       xmlnamedmap *map,
       xmlnode *newNode)

Parameter | In/Out | Description
--- | --- | ---
    xctx
    IN
| XML context
    map
    IN
| `NamedNodeMap`
    newNode
    IN
| new node to store in map

Returns

`(xmlnode *)` replaced `Node` [or `NULL`]

See Also: XmlDomSetNamedItem, XmlDomGetNamedItem, XmlDomGetNamedItemNS, XmlDomGetNodeMapItem, XmlDomGetNodeMapLength