Home > Archive > PHP Language > August 2005 > PHP XML Troubles - Please Help!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PHP XML Troubles - Please Help!
|
|
| Shannon Sumner 2005-08-11, 5:00 pm |
| I'm having quite a difficult time with a seemingly simple request. I
would like to search a network for documents or folders names
containing a specific word. The result need to be displayed in a
document tree. For example if my directory looked like this.
All about Black Pines(File)
/
Pine Trees(Dir)<
/ \
Trees(Dir) < Red Pine(Dir)
\
Elm Trees(Dir)
\
American Elms(Dir)
And I searched for the word "Pine" ...
The returned results would look like this ...
Trees->Pine Trees->All about Black Pines
->Red Pine
If I searched for the word "American"
My results should be ...
Trees->Elm Trees->American Elms
Since I plan on formatting the results graphically I don’t want the
folder structure listed twice for two files in the same folder. A
folder should only be displayed as a result if it is not within the
hierarchy of another search result.
It seemed to me the best way to tackle this problem was to list the
directory structure in XML. And perform a search on the xml and return
the result as a new xml file.
The first example would produce a file that looked like this:
<dir name="Trees">
<dir name="Pine Trees">
<file name="All about Black Pines" />
<dir name="Red Pines"></dir>
</dir>
</dir>
Any idea how I would tackle this? I could use xpath, xslt, or
whatever. Please let me know.
Thanks,
Shannon Sumner
| |
| Ryan Heuser 2005-08-15, 3:59 am |
| Shannon Sumner wrote:
> I'm having quite a difficult time with a seemingly simple request. I
> would like to search a network for documents or folders names
> containing a specific word. The result need to be displayed in a
> document tree. For example if my directory looked like this.
>
>
> All about Black Pines(File)
> /
> Pine Trees(Dir)<
> / \
> Trees(Dir) < Red Pine(Dir)
> \
> Elm Trees(Dir)
> \
> American Elms(Dir)
>
>
> And I searched for the word "Pine" ...
>
> The returned results would look like this ...
>
> Trees->Pine Trees->All about Black Pines
> ->Red Pine
>
>
> If I searched for the word "American"
>
> My results should be ...
>
> Trees->Elm Trees->American Elms
>
> Since I plan on formatting the results graphically I don’t want the
> folder structure listed twice for two files in the same folder. A
> folder should only be displayed as a result if it is not within the
> hierarchy of another search result.
>
> It seemed to me the best way to tackle this problem was to list the
> directory structure in XML. And perform a search on the xml and return
> the result as a new xml file.
>
> The first example would produce a file that looked like this:
>
> <dir name="Trees">
> <dir name="Pine Trees">
> <file name="All about Black Pines" />
> <dir name="Red Pines"></dir>
> </dir>
> </dir>
>
> Any idea how I would tackle this? I could use xpath, xslt, or
> whatever. Please let me know.
>
> Thanks,
>
> Shannon Sumner
You might want to check out the many XML packages in PEAR
( http://pear.php.net ).
Peace,
Ryan
|
|
|
|
|