If you have an XML Tree, you can add nodes using revAddXMLNode, put data
into the node using revPutIntoXMLNode and then use revXMLText(tXMLTree) to
save the text to a file name.
Here is a function I created to add data to an arbitrary node in an
existing tree (it creates all the nodes, if they do not exist, but assumes
the root node exists):
on SaveToXMLTree TreeID, Path, Data
if TreeID is a number then
-- see if the node exists
set the itemDelimiter to "/"
repeat with i = 2 to the number of items in Path - 1
put item 1 to i of Path into startNode
put item i+1 of Path into node
if revXMLChildNames(TreeID,startNode,"",node,false) is empty then
revAddXMLNode TreeID, startNode, node, ""
if the result contains "xmlerr" then
ReportError "Error adding node" && item 1 to i+1 of Path && "to
XML Tree:" && the result
end if
end if
end repeat
set the itemDelimiter to ","
if the platform is "MacOS" then
put the MacToISO of Data into Data
end if
revPutIntoXMLNode TreeID,Path,Data
if the result contains "xmlerr" then
ReportError "Error adding data to node" && Path && ":" && the result
end if
end if
end SaveToXMLTree
At 05:59 PM 3/29/2006, you wrote:
Hello All...
I'm trying to learn to use XML to store stack data. I've managed to load
an existing XML document into the stack, navigate through XML data using
revXMLMatchingNode and revXMLChildContents and placing contents in
specific flds, and creating additonal data using revSetXMLAttribute and
revAddXMLNode.
So far so good. However, ultimatley I want to be able to continue
navigating through the XML data including any new data that has been entered.
I can see that the additional data has been added by using
revXMLChildContents, however I don't know how to save the results of
revXMLChildContents back into the stack as a XML file, and thus enabling
navigation through the appended XML file.
I had been trying to do it using revCreateXMLTree but it errors because
revXMLChildContents does not return a proper XML format.
Any suggestions?
Thank you!
John Patten
SUSD
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Peter T. Evensen
http://www.PetersRoadToHealth.com
314-629-5248 or 888-628-4588
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution