johnpatten at mac.com
Thu Mar 30 19:20:47 EST 2006
Actually, dividing the number of nodes by ten gave me the number of attributes(I had ten nodes under each attribute). I was using this to determine which attribute to "navigate" to once the user selects "Next." (At this point in my learning I was not familiar with revXMLNextSibling and revXMLPreviousSibling :-)
Then I added the deleteXMNode and my navigation strategy was all for not. Then... I learned how to use the revXMLNextSibling and revXMLPreviousSibling and everythings great!
If it would help anyone here are scripts I'm using now to navigate through XML info:
//Moving to Previous data - just substitute revXMLNextSibling to move forward.
put cd fld "XMLID" into tTargetTree
put cd fld "URL_ID" into tTargetAttribute
put revXMLPreviousSibling(tTargetTree,tTargetAttribute) into targetNode
if the result is empty then
put targetNode into cd fld "Url_ID"
put revXMLChildContents(tTargetTree,TargetNode,tab&"*",cr,true,-1) into theData
put the itemdel into OrigItemDel
set the itemDel to "*"
put item 2 of line 1 of theData into cd fld "subject"
put item 2 of line 2 of theData into cd fld "Key_Words"
put item 2 of line 3 of theData into cd fld "Grade"
put item 2 of line 4 of theData into cd fld "standard"
put item 2 of line 5 of theData into cd fld "Title"
put item 2 of line 6 of theData into cd fld "Description"
put item 2 of line 7 of theData into cd fld "Submitted_By"
put item 2 of line 8 of theData into cd fld "email_address"
put item 2 of line 9 of theData into cd fld "School"
Date: Thu, 30 Mar 2006 12:38:30 -0600
From: Ken Ray <kray at sonsothunder.com>
Subject: Re: Navigating through added XML data?
To: Use Revolution List <use-revolution at lists.runrev.com>
Message-ID: <C05181C6.38B39%kray at sonsothunder.com>
Content-Type: text/plain; charset="US-ASCII"
On 3/30/06 12:01 PM, "John Patten" <johnpatten at mac.com> wrote:
> put revXMLNumberOfChildren(cd fld "XMLID","URL_Table",,-1) into
> put (numberOfNodes div 10)into theNewNode
> add 1 to TheNewNode
Just curious, John... why did you need to divide the number of child nodes
by 10 and add 1 to get the new node number? Wouldn't it just be (the number
of children + 1) ?
> 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?
You mean all the child nodes have the same content? Can you provide an
example of what you're seeing?
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the Use-livecode