Page 1 of 1

Pars XML for same TAG different LINE

Posted: Mon Jul 09, 2018 3:54 am
by gilar
Hello Everybody ....
I'm following this lesson
http://lessons.livecode.com/m/4071/l/70 ... n-xml-file
and Succes follow this tutorial
Now i have problem to pars XML for the same TAG in Different Line

Here is the XML file https://drive.google.com/open?id=18WMdf ... mDuM4jdUus
https://drive.google.com/open?id=13u9eq ... 4pjA04nsUo

There is two TAG
<teams> --- i can pars this line
<teams> --- I can not pars this line

This is my code

Code: Select all

private command processPreferencesTree pTree
   local tTextColor
   put revXMLNodeContents(pTree, "xml/teams/teamNumber") into tTeamSatu
   
   local tTeamDua
   put revXMLChildNames(pTree, "xml/teams/teamNumber", return, "teamNumber", true) into tTeamDua
   


Comment and help would be appreciate




Best Regards



Gilar Kadarsah | Indonesia

Re: Pars XML for same TAG different LINE

Posted: Wed Dec 12, 2018 7:03 pm
by MaxV
For the second result you need to use this path /xml/teams[2].
Use https://livecode.wikia.com/wiki/RevXMLNextSibling :

Code: Select all

put revXMLNodeContents(connID, "/xml/teams/detail/teamName"  ) 
put revXMLNodeContents(connID, "/xml/teams[2]/detail/teamName"  )
It works!