'revXMLNumberOfChildren' receiving xmlerr can't find element

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
Bevan
Posts: 3
Joined: Sat Jan 13, 2018 1:37 am

'revXMLNumberOfChildren' receiving xmlerr can't find element

Post by Bevan » Thu Apr 05, 2018 3:30 pm

Having trouble with the revXMLNumberOfChildren function.

All the code to retrieve the XML data is fine I just can't get the number of children.

Can anyone suggest what I am doing wrong. Thanks.

I have removed the put url into tXMLData1 and displayed the XML results below.

Code: Select all

on createTree
   
      put revCreateXMLTree(tXMLData1, true, true, true) into sXMLID1
   put  revXMLNumberOfChildren(sXMLID1, ”PlaceSearchResponse”, "result", -1) into theNumberOfChildren
   
end createTree

on populateFields
     put field "contactnumber" into tNumber
     put revXMLNodeContents(sXMLID1, "PlaceSearchResponse/result[" & tNumber & "]/place_id") into tId

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<PlaceSearchResponse>
 <status>OK</status>
 <result>
  <name>Sephardim</name>
  <type>bar</type>
  <type>restaurant</type>
  <type>food</type>
  <type>point_of_interest</type>
  <type>establishment</type>
  <formatted_address>71 King St, Warners Bay NSW 2282, Australia</formatted_address>
  <geometry>
   <location>
    <lat>-32.9751171</lat>
    <lng>151.6459440</lng>
   </location>
   <viewport>
    <southwest>
     <lat>-32.9765401</lat>
     <lng>151.6446036</lng>
    </southwest>
    <northeast>
     <lat>-32.9738404</lat>
     <lng>151.6473032</lng>
    </northeast>
   </viewport>
  </geometry>
  <rating>4.1</rating>
  <icon></icon>
  <reference>CmRbAAAA9Xai0680-aq6Vb-xU5w6fZpj8hRF63qVdWTHwT5wLZQPpmnUyenfXtN8eOkszx6kxgGP2tBng06nXdvMmiO2kFFZ4rHQ92nbIZneNStCCYwrYTKmeAzI8o5uacttNy_eEhCqZjCnilEL52mutbhktNi2GhRZ6PkryD3MF00lvaPETnVoaJzcIQ</reference>
  <id>1105314b27efb512a53e8f05a8a47160a0afa511</id>
  <opening_hours>
   <open_now>false</open_now>
  </opening_hours>
  <photo>
   <photo_reference>CmRaAAAAR1MpPfjIVK555vYPPzxGvOWkF4UGMBgc46MSY2GIqqU4SunDx3Lh4vcLMQcXFxb7HjXeTKO-ZJKN8eVS8cTEM4jBfMoR_5pDLT2afh6pTfUp2USMsMHz8AJAwcvW4WCvEhDBqh1Tca5mRCCcbV8OA2G-GhQ-NuhO7w35pCfnwyBpltbAE9V7HQ</photo_reference>
   <width>4032</width>
   <height>3024</height>
     </photo>
  <place_id>ChIJ5Q662_s8c2sRIi_SitqTVPU</place_id>
 </result>
 <result>
  <name>Travinos</name>

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”