Thanks Sarah and Peter!

Also Sarah's tutorial has been very helpful. I have never done anything with 
XML, or arrays for that matter, so it's still a lot of trial and error. It's 
kind of strange how you can stare at something for a couple hours, go away for 
a while, come back to it, and then BING, the solution just kind of jumps out at 
you.

What was messing me up was I was looking at the text of an xml file, and seeing 
it formatted correctly lead me to believe that the XML was good. When I started 
dumping out the XML after I added a new attribute and child nodes, I noticed I 
was not getting things right. Essentially, not getting the paths correct in the 
XML file for the new attribute and subsequent new child nodes.

Here is what finally worked for me:

 put cd fld "XMLID" into theTargetXML
  
  
  put revXMLNumberOfChildren(cd fld "XMLID","URL_Table",,-1) into numberOfNodes
  put (numberOfNodes div 10)into theNewNode
  add 1 to TheNewNode
  
  RevAddXMLNode theTargetXML,"URL_Table/","URL",""
  
  revSetXMLAttribute theTargetXML,"/URL_Table/URL"&"[" & theNewNode 
&"]","IDnum",theNewNode
  
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode 
&"]","subject","Art"
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode 
&"]","key_words","Fine Art"
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode &"]","Grade","5"
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode 
&"]","Standard","Creativity"
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode 
&"]","Title","Art in the Classroom"
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode 
&"]","Description","Will this work for Art"
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode 
&"]","Submitted_by","John Art"
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode 
&"]","emailAddress","[EMAIL PROTECTED]"
  revAddXMLNode theTargetXML,"/URL_Table/URL" &"[" & theNewNode 
&"]","school","Orchard School"


This seems to work correctly, however i do notice in the XML file the new 
attribute has all the content after it in addition to the nodes that have it 
individually. Not sure why it's doing that?

However, navigating through the attributes and associated nodes is not a big 
deal because I'm only using the first part of the attribute (i.e.1,2, 3..) when 
determining which group of nodes to display.

I'm sure there there are a lot more sophisticated ways to do what I'm trying to 
do, but at least I continue to be successful! :-)


Thank you!

John Patten
SUSD





-------------------------------------------------------------

Message: 23 
Date: Thu, 30 Mar 2006 13:26:33 +1000 
From: "Sarah Reichelt" <[EMAIL PROTECTED]> 
Subject: Re: Navigating through added XML data? 
To: "How to use Revolution" <use-revolution@lists.runrev.com> 
Message-ID: 
<[EMAIL PROTECTED]> 
Content-Type: text/plain; charset=ISO-8859-1 

> 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. 

_______________________________________________
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

Reply via email to