Click to return to the XML (Extensible Markup Language) home page    
IXMLDOMImplementation Int...     IXMLDOMNode Interface     XML DOM Interfaces    
Web Workshop  |  XML (Extensible Markup Language)

IXMLDOMNamedNodeMap Interface


This interface supports iteration through the collection of attribute nodes. It also provides methods that support the use of namespaces.

IXMLDOMNamedNodeMap Methods

getNamedItem Retrieves the attribute with the specified name.
getQualifiedItem Returns the attribute with the specified namespace and attribute name.
item Allows random access to individual nodes within the collection.
length Indicates the number of items in the collection.
nextNode Returns the next node in the collection.
removeNamedItem Removes an attribute from the collection.
removeQualifiedItem Removes the attribute with the specified namespace and attribute name.
reset Resets the iterator.
setNamedItem Adds the supplied node to the collection.

Remarks

The named node map object is a node collection that allows access by name as well as by index. This collection is typically used for attributes.

Note that the World Wide Web Consortium (W3C) document object model (DOM) definition does not require IXMLDOMNamedNodeMap objects to be maintained in any particular order. Objects contained in an IXMLDOMNamedNodeMap can also be accessed by an ordinal index, but this is simply to allow convenient enumeration and does not imply that the DOM specifies an order to these nodes. DOM implementations are not required to preserve the node order.

The Microsoft implementation preserves the attributes in the order in which they appear in the source. Additional attributes are added to the end of the list. Note that a namespace attribute (xmlns) is inserted as the first in the list if the tag name requires the namespace, or immediately before the attribute that uses an undeclared namespace.

Like the node list, however, a named node map collection is live; that is, the addition and removal of nodes, and changes within nodes, are immediately reflected in the collection. This means that two successive requests for items using the same index can return two different items, depending on changes to the collection. This also means that changes to the node objects are immediately available in the nodes obtained from the list.

Note that when a default value is specified in the schema for an attribute and that attribute is removed, it is automatically regenerated with the default value, as specified in the W3C standard. The attribute reappears immediately because the collection is live, with a corresponding change to the count of items in the collection. When removing an attribute with such a default setting, you will need to again retrieve the number of items in the collection to obtain an accurate count. You should also reset any index into the collection.

Interface Information

Implementation Msxml.dll
Inherits from IDispatch
Header and IDL files Msxml.h, Xmldom.idl
Minimum availability Internet Explorer 5
Minimum operating systems Windows 95, Windows NT


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.