Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working With XML.
#1
How to Modify the data in an existing XML Path.

From looking around the help files, I would say right off that QM would load the XML file, assign data in a specified XML path to variables, modify the changes to those variables, use the Delete command to delete the top node of the path which will delete all descending nodes, and then add the node back with the modified data. Example please? Or if there is a better way altogether.

Attributes and what they are used for.
Really just don't see the light...Can't think of ways to use these suckers. I've gotten a couple errors trying to use these guys too, where if I try to add an attribute to a Node, the following code will : "0x80070057, The parameter is incorrect". Shed some light? It happens if I try to add a child to a child with an attribute. Since I really don't get the whole idea behind these things, I don't know why this is like this.

I feel attributes could be very useful, but just don't grab how. Can I get a variety of examples using attributes in XML so I can get a better grab on usefulness and start to really fly.

Thanks,
Jimmy Vig
#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.
#3
Works like a charm.

xml.Path("root/child").Value="new data"

I like the way this one works best...it is just simple and to the point.

Thanks so much,
Jimmy Vig


Forum Jump:


Users browsing this thread: 1 Guest(s)