tags:

views:

81

answers:

1

i am trying to parse bing search xml but whenever i try to access xml element there is colon in every elemet

which gives error Parse error: syntax error, unexpected ':' in /

here is my php code

   foreach($searchresponse->web:Web->web:Results as $result) 
{ 
      printf(" \n%s", $result->web:Description); 
}     

here is bing xml response

<SearchResponse Version="2.2">
−
<Query>
 <SearchTerms>ipl</SearchTerms>
</Query>
−
<web:Web>
<web:Total>2430000</web:Total>
<web:Offset>0</web:Offset>
−
<web:Results> 
−
<web:WebResult>
<web:Title>Indian Premier League | IPLT20</web:Title>  

what is the meaning of colon in xml tags.

A: 

Colons in xml nodes denote a namespace. Its likely you will be able to parse your xml more easily with something like DOM or SimpleXML which both have support for namespaced nodes. There's a good article here which discusses simpleXML and namespaces.

seengee
Shouldn't every XML parser support namespaces, as they are a part of XML?
Joey