Avatar of Neil Thompson
Neil Thompson
Flag for United Kingdom of Great Britain and Northern Ireland asked on

return part of xml to JSON after a xpath search

Hi all

I want to be able to pass a "wardTitle" variable to the XML from this page and be able to save just the resulting details as json.

The following returns a XML file of all our councillors and their details. I want to be able to filter on the passed "wardTitle" and only then return the details associated with the councillors who come under that wardtitle

https://www.folkestone-hythe.gov.uk/moderngov/mgWebService.asmx/GetCouncillorsByWard


For example If I pass "Cheriton Ward" only the node <wardtitle>Cheriton Ward</wardtitle> would be returned with all it's children so thats the <councillors node> and 3 <councillor> nodes with their associated content

I have tried using xpath but It then seems really cumbersome to iterate through every single node rather than just be able to grab that and convert it to json

one of the 3 councillor nodes for Cheriton ward

I hope that makes sense, if not please shout :(
XMLPHP

Avatar of undefined
Last Comment
Zvonko

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Zvonko

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck