Class NamedNodeMap

XML DOM NamedNodeMap class.

Index is kept in array part of the object, names in a separate table.

Note: the item method returns based on 1-indexed!

Use the methods only to change, to keep the two in-sync. For faster iteration use the Lua-array.

This class is used for the attributes property of an Element node. As well as for 'entities' and 'notations' properties on the DocumentType node.

See the NamedNodeMap interface.

Tables

NamedNodeMap.properties Properties of the NamedNodeMap class

Methods

NamedNodeMap:getNamedItem (name) Returns an item by name, implements getNamedItem.
NamedNodeMap:getNamedItemNS (namespaceURI, name) Returns an item by name and namespaceURI, implements getNamedItem.
NamedNodeMap:item (idx) Returns item by index, implements item.
NamedNodeMap:removeNamedItem (name) Removes an item by name, implements removeNamedItem.
NamedNodeMap:removeNamedItemNS (namespaceURI, name) Removes an item by name and namespaceURI, implements removeNamedItemNS.
NamedNodeMap:removeNamedItemNS (arg) Removes an item by name and namespaceURI, implements removeNamedItemNS.
NamedNodeMap:setNamedItem (arg) Sets an item by name, implements removeNamedItem.


Tables

NamedNodeMap.properties
Properties of the NamedNodeMap class

Fields:

  • length the number of items in the NamedNodeMap (readonly)
  • parentNode the parent Node to which this NamedNodeMap belongs, additional to the DOM2 spec (readonly)

Methods

NamedNodeMap:getNamedItem (name)
Returns an item by name, implements getNamedItem.

Parameters:

  • name string the name of the item to return

Returns:

    the item, nil if not found
NamedNodeMap:getNamedItemNS (namespaceURI, name)
Returns an item by name and namespaceURI, implements getNamedItem.

Parameters:

  • namespaceURI string the namespace URI of the item to return
  • name string the local name of the item to return

Returns:

    the item, nil if not found
NamedNodeMap:item (idx)
Returns item by index, implements item. Indices 1-indexed.

Parameters:

  • idx int index of item to return

Returns:

    the item, nil if not found
NamedNodeMap:removeNamedItem (name)
Removes an item by name, implements removeNamedItem.

Parameters:

  • name string the name of the item to return

Returns:

    the item, nil+err
NamedNodeMap:removeNamedItemNS (namespaceURI, name)
Removes an item by name and namespaceURI, implements removeNamedItemNS.

Parameters:

  • namespaceURI string the namespace URI of the item to remove
  • name string the local name of the item to remove

Returns:

    the removed item, or nil+err
NamedNodeMap:removeNamedItemNS (arg)
Removes an item by name and namespaceURI, implements removeNamedItemNS.

Parameters:

  • arg Attribute, Entity or Notation the object to store

Returns:

    the existing item or true if there was none, or nil+err
NamedNodeMap:setNamedItem (arg)
Sets an item by name, implements removeNamedItem.

Parameters:

  • arg Attribute, Entity or Notation the object to store

Returns:

    the existing item or true if there was none, or nil+err
generated by LDoc 1.4.6 Last updated 2022-04-22 13:38:32