XML DOM - Đối tượng NamedNodeMap
Đối tượng NamedNodeMap đại diện cho một danh sách các nút không có thứ tự.
Đối tượng NamedNodeMap
Các nút trong NamedNodeMap có thể được truy cập thông qua tên của chúng.
NamedNodeMap luôn được cập nhật. Nếu một phần tử bị xóa hoặc thêm vào, trong danh sách nút hoặc tài liệu XML, danh sách sẽ tự động được cập nhật.
Lưu ý: Trong bản đồ nút được đặt tên, các nút không được trả về theo bất kỳ thứ tự cụ thể nào.
Thuộc tính đối tượng NamedNodeMap
Property | Description |
---|---|
length | Returns the number of nodes in the list |
Các phương thức đối tượng NamedNodeMap
Method | Description |
---|---|
getNamedItem() | Returns the node with the specific name |
getNamedItemNS() | Returns the node with the specific name and namespace |
item() | Returns the node at the specified index |
removeNamedItem() | Removes the node with the specific name |
removeNamedItemNS() | Removes the node with the specific name and namespace |
setNamedItem() | Sets the specified node (by name) |
setNamedItemNS() | Sets the specified node (by name and namespace) |