Page 1 of 1

Xml parsing

Posted: Wed Apr 08, 2009 1:02 am
by sanju
Hi all,

I need a search to be done on a xml file and print the found matches. Its a xml file with product and brands , by using php how can I do that.. Here is the format of xml..

- <categories>
- <category id="1" name="Flowline equipments">
- <products>
<product id="1">Hammer Unions</product>
<product id="2">Swivel Joints</product>
<product id="3">Pup Joints</product>
<product id="4">Chiksan Loops</product>
<product id="5">API Valves</product>
<product id="6">Manifolds</product>
<product id="7">Flanges & Fittings</product>
<product id="8">Ring Joint Gaskets</product>
<product id="9">Stud Bolts</product>
</products>
- <brands>
<brand id="1">FMC</brand>
<brand id="2">ANSON</brand>
<brand id="3">KEMPER</brand>
<brand id="4">SPM</brand>
<brand id="5">AMERICAN BLOCK</brand>
<brand id="6">SARA SAE</brand>
<brand id="7">PARVEEN OILFIELD</brand>
<brand id="8">WINDGLASS ENGINEERS</brand>
<brand id="9">SMITH</brand>
<brand id="10">LAMONS</brand>
<brand id="11">FLEXITALLIC</brand>
</brands>
</category>
</categories>

pls help

Re: Xml parsing

Posted: Wed Apr 08, 2009 1:24 am
by Christopher
http://us2.php.net/manual/en/refs.xml.php

There are many solutions in PHP. SimpleXML is the easiest way to read XML files.

Re: Xml parsing

Posted: Wed Apr 08, 2009 1:25 am
by susrisha
what do you want to search for??

Re: Xml parsing

Posted: Wed Apr 08, 2009 1:38 am
by sanju
I need to serch for the products and brands. Actually site is a static one and need to have a secrh option