AW: revAddXMLNode - how to specify a parent node if multiple?
Tiemo Hollmann TB
toolbook at kestner.de
Wed Aug 8 12:49:10 EDT 2012
Hi Jan,
great! I knew, there must have been such a straight forward method :)
Thanks again!
Tiemo
> -----Ursprüngliche Nachricht-----
> Von: use-livecode-bounces at lists.runrev.com [mailto:use-livecode-
> bounces at lists.runrev.com] Im Auftrag von Jan Schenkel
> Gesendet: Mittwoch, 8. August 2012 17:30
> An: How to use LiveCode
> Betreff: Re: revAddXMLNode - how to specify a parent node if multiple?
>
> You need to use brackets and indices in the path to the parent node.
>
> Here's a quick example to explain it:
> - create a new stack
> - drop a field onto it
> - drop a button onto it and set its script to ##on mouseUp
> local tXMLText,tXMLTree
> put "<?xml version=" & quote & "1.0" & quote & "?>" & return & \
> "<products />" into tXMLText
> put revCreateXMLTree(tXMLText,false,true,false) into tXMLTree
> --
> local tRootNode, tCurrentNode
> put revXMLRootNode(tXMLTree) into tRootNode
> repeat with tIndex = 1 to 3
> revAddXMLNode tXMLTree, tRootNode, "productidentifier", empty,
> "after"
> put tRootNode & "/productidentifier[" & tIndex & "]" into
> tCurrentNode
> revAddXMLNode tXMLTree, tCurrentNode, "b221", tIndex
> end repeat
> --
> put revXMLText(tXMLTree, empty, true) into field 1
> revDeleteXMLTree tXMLTree
> end mouseUp
> ##
>
> Now click on the button and you should see the following text appear:
> ##
> <?xml version="1.0"?>
> <products>
> <productidentifier><b221>1</b221></productidentifier>
> <productidentifier><b221>2</b221></productidentifier>
> <productidentifier><b221>3</b221></productidentifier>
> </products>
>
> ##
>
>
> HTH,
>
>
> Jan Schenkel.
>
>
> =====
> Quartam Reports & PDF Library for LiveCode www.quartam.com
>
>
> =====
> "As we grow older, we grow both wiser and more foolish at the same time."
> (La Rochefoucauld)
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list