pritis_dwibedi Posted July 22, 2009 Share Posted July 22, 2009 Hello, i am really in need of some help. i want to read the values from a xml based on some specific node value. for example i want the resources present in second configuration file having id=1. please do solve my problem, i have been trying this problem from last two days, its urgent. thank you, pritish my xml is: <configuration> <id>0</id> <systemId>1</systemId> <name>USER-1</name> <resource> <id>1</id> <systemId>1</systemId> </resource> <resource> <id>2</id> <systemId>1</systemId> </resource> </configuration> <configuration> <id>1</id> <systemId>2</systemId> <name>USER-2</name> <resource> <id>1</id> <systemId>1</systemId> </resource> <resource> <id>2</id> <systemId>1</systemId> </resource> </configuration> <configuration> <id>2</id> <systemId>3</systemId> <name>USER-3</name> <resource> <id>1</id> <systemId>1</systemId> </resource> <resource> <id>2</id> <systemId>1</systemId> </resource> </configuration> Link to comment https://forums.phpfreaks.com/topic/166930-xml-parsing/ Share on other sites More sharing options...
dzelenika Posted July 22, 2009 Share Posted July 22, 2009 this is from php documentation: $xmlstr = <<<XML <?xml version='1.0' standalone='yes'?> <movies> <movie> <title>PHP: Behind the Parser</title> <characters> <character> <name>Ms. Coder</name> <actor>Onlivia Actora</actor> </character> <character> <name>Mr. Coder</name> <actor>El ActÓr</actor> </character> </characters> <plot> So, this language. It's like, a programming language. Or is it a scripting language? All is revealed in this thrilling horror spoof of a documentary. </plot> <great-lines> <line>PHP solves all my web problems</line> </great-lines> <rating type="thumbs">7</rating> <rating type="stars">5</rating> </movie> </movies> XML; $xml = new SimpleXMLElement($xmlstr); echo $xml->movie[0]->plot; // "So this language. It's like..." Link to comment https://forums.phpfreaks.com/topic/166930-xml-parsing/#findComment-880156 Share on other sites More sharing options...
dzelenika Posted July 22, 2009 Share Posted July 22, 2009 if you have some question ask while I'm still here Link to comment https://forums.phpfreaks.com/topic/166930-xml-parsing/#findComment-880158 Share on other sites More sharing options...
RichardRotterdam Posted July 22, 2009 Share Posted July 22, 2009 Look into simpleXML also you might want to look into xpath. For examples try a search on this forum or look at the xml tutorial you can find on http://www.phpfreaks.com/tutorial/handling-xml-data Link to comment https://forums.phpfreaks.com/topic/166930-xml-parsing/#findComment-880160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.