txmlnode_setattribute.bmx 478 B

12345678910111213141516171819202122232425262728
  1. SuperStrict
  2. Framework text.xml
  3. Import BRL.StandardIO
  4. Local doc:TxmlDoc = TxmlDoc.newDoc("1.0")
  5. If doc Then
  6. Local root:TxmlNode = TxmlNode.newNode("root")
  7. doc.setRootElement(root)
  8. ' create a new empty node
  9. Local node:TxmlNode = root.addChild("node")
  10. Print node.toString()
  11. ' set an attribute
  12. node.setAttribute("attr1", "a value")
  13. Print node.toString()
  14. ' change the attribute value
  15. node.setAttribute("attr1", "a new value")
  16. Print node.toString()
  17. End If