Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.1 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> XML Management > xmlSetAttributes

xmlSetAttributes

Set the attributes name and value.

Calling Sequence

xmlObj = xmlSetAttributes(xmlObj, nameValue)

Arguments

xmlObj

xmlObj, a XML mlist typed XMLSet or XMLList or XMLElem or XMLAttr

nameValue

nameValue, a matrix nx2 or nx3 of strings where each rows contains [name value] or [prefix name value]

Description

Set the attributes of an element or a list of elements.

Examples

doc = xmlReadStr("<root><a><b><c></c></b></a><b></b></root>");

// Retrieve all the nodes
xp = xmlXPath(doc, "//*");

// Add the attributes hello="world" and bonjour="monde" to all the nodes
xmlSetAttributes(xp, ["hello" "world" ; "bonjour" "monde"]);
xmlDump(doc)

// Add the attribute foo="bar" to the first child of root
xmlSetAttributes(doc.root.children(1), ["foo" "bar"]);
xmlDump(doc)

// Add the attribute bar="foo" to all the children of root
xmlSetAttributes(doc.root.children, ["bar" "foo"]);

// Add the attribute truc="machin" to the list of the attributes of the second <b>
xmlSetAttributes(doc.root.children(2).attributes, ["truc" "machin"]);
xmlDump(doc)

xmlDelete(doc);

See Also

  • XMLObjects — Describe the properties of the different XML objects

History

VersãoDescrição
5.4.0 XML module introduced.
Report an issue
<< xmlSchema XML Management xmlValidate >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 02 13:57:41 CEST 2014