XPath Search
Brought to you by:
bs_php,
nigelswinson
From: Tod M. <tod...@gm...> - 2006-01-14 19:55:45
|
I just found this class and it seems to offer exactly what I want. I'm new to it & xpath though so I'm slowly learning how to do things. I want to perform a search on my XML database for a string entered by a user. Say fo= r instance "cabinet". From this I want to search several XML files of the following structure: <?xml version=3D"1.0"?> <!DOCTYPE product PUBLIC "-//RYE//DTD IMAGEDB 1.0 Strict//EN" "component.dt= d "> <product> <component id=3D"wall_cab"> <title>Wall Cabinet</title> <image src=3D"/images/cabinetry/wall_cab.jpg" /> <link href=3D"/products/cabinetry/wall.html" /> <feature>Sturdy double wall door </feature> <feature>Door has perforated inside wall for hanging hooks for tools etc</feature> <feature>Solid steel construction 20-Gauge (.036") thick </feature> <feature>One shelf included 24" x 10" x 0.6" </feature> <keywords>tools sports sporting </keywords> </component> <component id=3D"component2"> ... </component> </product> I have added keywords to enhance the search functionality. What I want to do is extract the title, image, and link of any product that contains, in any tag, the string entered by the user. I'm not exactly sure how to do this. Can someone point me in the right direction? I know it's asking a lot, but even a quick pointer would help me out. I'm not a very experienced php programmer . Thanks very much, Brad |