revXML help

Simon Lord slord at karbonized.com
Fri Jul 2 14:52:10 EDT 2010


I'm tearing my hair out trying to read various values.  What should be
trivial is continuously spitting errors in my face and I'm quite
frustrated.  :P

Here is my XML—it is successfully loaded into my stack after reading
it in.  I can also get the root node and ID.  But I can't get anything
else to work for me.  Here is the code, my question(s) will follow
after it:

<?xml version="1.0"?>
<testXML>

  <project name="Stage 1" splash=""
icon="/Users/slord/test/projects/DCP_0254.jpg">
    <screen name="">
      <image id="" zindex="" path="" height="" width="" top="" left=""
start="" end="" url="">
      </image>
    </screen>
   </project>

  <project name="Stage 2" splash=""
icon="/Users/slord/test/projects/DCP_0254.jpg">
    <screen name="">
      <image id="" zindex="" path="" height="" width="" top="" left=""
start="" end="" url="">
      </image>
    </screen>
   </project>

  <project name="Stage 3" splash=""
icon="/Users/slord/test/projects/DCP_0254.jpg">
    <screen name="">
      <image id="" zindex="" path="" height="" width="" top="" left=""
start="" end="" url="">
      </image>
    </screen>
   </project>

</testXML>

To start off, I need to get the attribute for "icon" in "project".

Here is my code to date:

repeat for revXMLNumberOfChildren(tDocID,"testXML","project",1) times
    put revXMLRootNode(tDocID) into tParentNode // this works, thanks Sarah!
    put revXMLAttribute(tDocID, tParentNode, "icon") into tChild //
returns error
end repeat

I also need to know how to loop through all 3 <project> nodes getting
the value for "icon". IE, tParentNode[x].



More information about the use-livecode mailing list