属性の名前と値を設定する.
xmlObj = xmlSetAttributes(xmlObj, nameValue)
xmlObj, XMLSet または XMLList または XMLElem または XMLAttr型 のXML mlist
nameValue, [name value] または [prefix name value]を各行に含む 文字列の n x 2 または n x 3 行列
要素または要素のリストの属性を設定します.
doc = xmlReadStr("<root><a><b><c></c></b></a><b></b></root>"); // 全てのノードを取得します xp = xmlXPath(doc, "//*"); // 属性 hello="world" および bonjour="monde" を全ノードに追加します xmlSetAttributes(xp, ["hello" "world" ; "bonjour" "monde"]); xmlDump(doc) // 属性 foo="bar" をルートの最初の子に追加します xmlSetAttributes(doc.root.children(1), ["foo" "bar"]); xmlDump(doc) // 属性 bar="foo" をルートの全ての子に追加します xmlSetAttributes(doc.root.children, ["bar" "foo"]); // 属性 truc="machin" を2番目の子<b>の属性のリストに追加します xmlSetAttributes(doc.root.children(2).attributes, ["truc" "machin"]); xmlDump(doc) xmlDelete(doc); | ![]() | ![]() |
Version | Description |
5.4.0 | XMLモジュールが導入されました. |