Page 1 of 1

Issue Parsing XML in live code, Insights appreciated.

Posted: Tue Jul 10, 2012 4:49 pm
by TrevorDowdle
I am having an issue accessing all the date values in the following xml

<entries>
<entry>
<date>2011-08-18</date>
<name></name>
</entry>
<entry>
<date>2011-08-19</date>
<name></name>
</entry>
<entry>
<date>2011-08-20</date>
<name></name>
</entry>
</entries>

With the following code I am accessing just one of the date nodes but am having trouble getting the node contents for each date node.

Code: Select all

local tPosts
   put revXMLChildNames(pTree, "entries/entry", return, "date", true) into tPosts     
   local tListOfDates

   repeat for each line tDate in tPosts
      put revXMLNodeContents(pTree, "entries/entry/" & tDate) & return after tListOfDates
   end repeat
Appreciate any insight or help you can give me.

Thanks

Re: Issue Parsing XML in live code, Insights appreciated.

Posted: Tue Jul 10, 2012 5:19 pm
by mwieder
I think you're drilling down too deep to start with. Try this

Code: Select all

    put revXMLChildNames(pTree, "entries" , return, , true) into tPosts
    repeat for each line tEntry in tPosts
        put revXMLNodeContents(pTree, "entries/" & tEntry & "/date" ) & return after tListOfDates
    end repeat

Re: Issue Parsing XML in live code, Insights appreciated.

Posted: Tue Jul 10, 2012 5:35 pm
by TrevorDowdle
That did it!


Thanks