Searching XML with revXMLMatchingNode

Todd Geist todd at geistinteractive.com
Mon Sep 9 11:50:19 EDT 2013


Hello,

I am trying to scan an xml document and find all the nodes of a certain 
name that have a particular attribute and value.  It would seem that 
"revXMLMatchingNode" was made for this purpose.  But I can't get it to 
find anything other then the first instance. There doesn't seem to be 
anyway to tell it to pick up where it left off the last go around.

The second parameter is the Starting Node, but it appears that what ever 
searching is done is done *underneath" this node.  The function does not 
continue working it's way through the XMl tree.

Here is some code I am trying

    put fld id 1006 into xmlTree
    put "Script" into theNodeToLookFor
    put "id" into theAttributeToSearch
    put 1 into theValueToFind
    put revXMLRootNode(xmlTree) into startingNode

    repeat until allDone
       put revXMLMatchingNode (xmlTree, startingNode , theNodeToLookFor, 
theAttributeToSearch, theValueToFind, -1) into theResult
       if theResult contains "xmlerr" or theResult is Empty then
          put true into allDone
       else
          put theResult
          put theResult into startingNode
       end if

    end repeat

--



Does anybody have any experience searching large xml docs?  Is there a 
way around this? Is there a way to get the next Match or all Matches?

(sadly I just found that I posted essentially this same question in 
2006. 7 years ago, yikes! )

Todd




More information about the use-livecode mailing list