Hi,

First I think that you have an error in your code!
Line Code : for ($i = 0; $i < strlen($markers); $i++)

$markers it's an array not a string so you must do : count($markers)
not strlen($markers), we use strlen to get string length!

Hope this help.

Regards.

On 18 juin, 21:30, Ivan <[email protected]> wrote:
> Hi Guys,
>
> I have my xml file I want to extract the label name by searching an
> xml file for country code.
>
> <markers>
> <marker continent="na" zoom="7" label="Guatemala" cc="gt"   />
>  </markers>
>
>  I have the following php code to match cc. I get an error that says :
> Object of class DOMNodeList could not be converted to string on the
> for loop.
>
>         $doc = new DOMDocument();
>         $doc->load( 'http://www.mysite.com/files/english/
> countries.xml' );
>
>         $markers = $doc->getElementsByTagName("marker");
>
>         for ($i = 0; $i < strlen($markers); $i++)
>         {
>
>          $countrycode =  $markers[i].getAttribute("cc");
>          $label = $markers[i].getAttribute("label");
>
>          if(strtolower($ucountrycode) == strtolower($countrycode))
>          {
>           echo "<script>alert(\"$label\");</script>";
>          }
>          else{
>          }
>         }
>
> Do i need to comvert $markers to string?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to