How do I parse an XML file for a search?

Hi! I need to use PHP to create a search that will parse an XML file and return formatted information for an online store. Here is a link to the XML file if anyone is interested in taking this on!

http://store.surplusoutletinc.com/yhst-13261419795447/objinfo.xml

Thanks!


2 Responses to “How do I parse an XML file for a search?”

  • Riyadh Hossain:

    See the following PHP class

    XML To Array http://www.phpclasses.org/browse/package/2938.html

    At first make it as a php array and then do the search operation on array.

  • rons_brain:

    Use the XML parsing functions in PHP (http://us3.php.net/xml), load in your document, then use XPath expressions to pull back node sets mathing the search criteria.

    A better alternative is to import the XML data into a database. The schema looks fairly normalized, so this shouldn’t be difficult, and will provide much better performance compared to loading an XML file every time the user wants to do a search. Also, the XML files may get very large, which will really degrade performance down the road (not a scalable solution).

Leave a Reply