How can convert one xml to another xml based on the tag value by xpath in PHP?

D3FC0N

New Member
How can I convert xml to another xml format by using xpath? The xml file is dynamic,it could be any levels, different tags. The following xml is a sample:\[code\]<?xml version="1.0"?> <student_info> <total_stud>500</total_stud> <student> <id>1</id> <name>abc</name> <address> <city>Pune</city> <zip>411006</zip> </address> </student> <student> <id>1</id> <name>bbc</name> <address> <city>Toronto</city> <zip>82233</zip> </address> </student> <student> <id>2</id> <name>wec</name> <address> <city>North York</city> <zip>59522</zip> </address> </student> </student_info> \[/code\]To: all the student "id=1"\[code\]<?xml version="1.0"?><student_info> <student> <name>abc</name> <city>Pune</city> <zip>411006</zip> </student> <student> <name>bbc</name> <city>Toronto</city> <zip>82233</zip> </student></student_info>\[/code\]
 
Back
Top