Main Content

matlab.io.xml.dom.NamedNodeMap class

Package:matlab.io.xml.dom

Set of document nodes with names

Description

Amatlab.io.xml.dom.NamedNodeMapobject contains a set of nodes that have names. These methods return aNamedNodeMapobject:

Thematlab.io.xml.dom.NamedNodeMapclass is ahandleclass.

Class Attributes

ConstructOnLoad
true
HandleCompatible
true

For information on class attributes, seeClass Attributes.

Properties

expand all

Number of items in the list, specified as a double.

Attributes:

GetAccess
public
SetAccess
immutable
Transient
true
NonCopyable
true

Methods

expand all

Examples

collapse all

This example finds and displays the names and values of the attributes of an element.

Read an XML string into amatlab.io.xml.dom.Documentobject.

importmatlab.io.xml.dom.*doc = parseString(Parser,'Hello');

Get the elements namedpara.

paralist = getElementsByTagName(doc,'para'); m = getLength(paralist)-1; s ='';

For everyparaelement, get the attribute names and values and save them in the character vectors.

fori = 0:m para = item(paralist,i); attrlist = getAttributes(para); n = getLength(attrlist)-1;forj=0:n attr = item(attrlist,j); s = [s sprintf('%s = %s\n',getNodeName(attr),getNodeValue(attr))];endend

Display the attribute names and values stored ins.

disp(s);
Bold = on Color = red
Introduced in R2021a