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). |
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.
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 |
(xmlnode *)
Node
with the specified name [or NULL
]
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.
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 |
(xmlnode *)
node with given local name and namespace URI [or NULL
]
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.
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
|
(xmlnode *)
node at the nth position in the map (or NULL
)
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.
ub4 XmlDomGetNodeMapLength( xmlctx *xctx, xmlnamedmap *map)
Parameter | In/Out | Description |
---|---|---|
xctx |
IN |
XML context |
map |
IN |
NamedNodeMap
|
(ub4)
number of nodes in NamedNodeMap
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.
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 |
(xmlnode *)
node removed from this map
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.
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 |
(xmlnode *)
node removed from this map
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.
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 |
(xmlnode *)
the replaced node (or NULL
)
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.
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 |
(xmlnode *)
replaced Node
[or NULL
]