Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working With XML.
#2
Macro
Code:
Copy      Help
out
str s=
;<root>
,;<child>data</child>
;</root>
IXml xml=CreateXml
xml.FromString(s)

;_________________________

;modify data in <child> node
xml.Path("root/child").Value="new data"
;or
;IXmlNode n=xml.Path("root/child")
;n.Value="new data"
;or
;ARRAY(IXmlNode) a
;xml.Path("root/child" a)
;a[0].Value="new data"

xml.ToString(s); out s

------------------------------
Attributes are very similar to child nodes. The same data can be stored in a child node or in an attribute.

For example, you can use

<node><a>xxx</a></node>

or

<node a="xxx"></node>

Child nodes are more universal and extensible than attributes. But with attributes the xml is smaller. I sometimes use children, sometimes attributes. Maybe need more experience to decide which and when is better. Also read a couple of XML tutorials on the web.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)