ryeguy Posted December 1, 2008 Share Posted December 1, 2008 I have an XML file and would like to perform something remotely similar to SQL select statements. Is there any native php way to do this? I know there is XQuery, but I am on a shared host and I don't know if I could get it installed. If there is no way to do this, would stepping through each node and checking the conditions be that intensive of a script? Link to comment https://forums.phpfreaks.com/topic/134994-solved-is-there-a-way-to-query-xml/ Share on other sites More sharing options...
cooldude832 Posted December 1, 2008 Share Posted December 1, 2008 http://us2.php.net/xml Link to comment https://forums.phpfreaks.com/topic/134994-solved-is-there-a-way-to-query-xml/#findComment-703056 Share on other sites More sharing options...
tapos Posted December 1, 2008 Share Posted December 1, 2008 u can use xpath functions. see here http://www.php.net/manual-lookup.php?pattern=xpath Link to comment https://forums.phpfreaks.com/topic/134994-solved-is-there-a-way-to-query-xml/#findComment-703057 Share on other sites More sharing options...
ryeguy Posted December 1, 2008 Author Share Posted December 1, 2008 I don't mean to just pull a specific element out of an xml file. I mean like how I can specify conditions for what nodes are pulled. Something like SELECT customer_id FROM xml_file WHERE Age > 5 or whatever. Although I didn't rigorously review your suggestions, I don't think that's it. Link to comment https://forums.phpfreaks.com/topic/134994-solved-is-there-a-way-to-query-xml/#findComment-703060 Share on other sites More sharing options...
MatthewJ Posted December 1, 2008 Share Posted December 1, 2008 I would agree that xpath is the way to go... read more Link to comment https://forums.phpfreaks.com/topic/134994-solved-is-there-a-way-to-query-xml/#findComment-703065 Share on other sites More sharing options...
cooldude832 Posted December 1, 2008 Share Posted December 1, 2008 You could use MySQL here to temp load a XML file into MySQL Using the doc structure as your table structure, and then query off the table using MySQL, but that sounds like too much work Link to comment https://forums.phpfreaks.com/topic/134994-solved-is-there-a-way-to-query-xml/#findComment-703067 Share on other sites More sharing options...
ryeguy Posted December 1, 2008 Author Share Posted December 1, 2008 Oh you're right, I didn't read far enough into it. Thanks! Link to comment https://forums.phpfreaks.com/topic/134994-solved-is-there-a-way-to-query-xml/#findComment-703068 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.