08-13-2008, 07:23 AM
Macro
------------------------------
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.
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.