Skip to content
Advertisement

Using SimpleXML to extract data from XML page returning empty array

I’m trying to extract the values of all elements named wardtitle from this xml page: https://democracy.ashfield-dc.gov.uk/mgWebService.asmx/GetCouncillorsByWard

Here’s the code I’m currently trying:

JavaScript

The children dump seems to work fine, the $ward variable returns nothing, then the xpath attempt returns the correct number of results, but all empty… Any help very much appreciated.

Advertisement

Answer

According to xml structure: wardtitle is a node of each ward, which in turn – node of wards, so, to echo wardtitle of first ward:

JavaScript

As for emails – everything works fine:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement