Pars XML for same TAG different LINE

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gilar
Posts: 96
Joined: Sat Sep 26, 2015 12:59 pm

Pars XML for same TAG different LINE

Post by gilar » Mon Jul 09, 2018 3:54 am

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
Gilar | from INDONESIA

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Pars XML for same TAG different LINE

Post by MaxV » Wed Dec 12, 2018 7:03 pm

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!
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”