Jaap has asked for the wisdom of the Perl Monks concerning the following question:
The above xml doc would generate a data structure like this:<?xml version="1.0"> <colors> <paprika> <good>red</good> <bad>green</bad> </paprika> <banana>yellow</banana> </colors>
Now if the XPath query looks like this: /colors/paprika/bad then we'd start with the last part: bad, find it in the array and see if his parent is paprika (this can be done VERY fast since we have the arrayindex of the parent). If it is paprike, look for his parent to see if it's colors. If all that's true, we have the byteIndex to look in the XML document for the content of the element.my @dataStructure = ( 'colors,-1,22', 'paprika,0,33', 'good,1,47', 'bad,1,68', 'banana,0,100', );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Idea for XPath implementation
by mirod (Canon) on Apr 01, 2003 at 11:45 UTC | |
|
Re: Idea for XPath implementation
by BrowserUk (Patriarch) on Apr 01, 2003 at 10:24 UTC | |
by Jaap (Curate) on Apr 01, 2003 at 11:02 UTC | |
|
Re: Idea for XPath implementation
by zby (Vicar) on Apr 01, 2003 at 10:30 UTC | |
by Jaap (Curate) on Apr 01, 2003 at 11:06 UTC | |
by zby (Vicar) on Apr 01, 2003 at 11:14 UTC | |
|
Re: Idea for XPath implementation
by dakkar (Hermit) on Apr 01, 2003 at 11:36 UTC | |
by Jaap (Curate) on Apr 01, 2003 at 20:01 UTC | |
|
Re: Idea for XPath implementation
by thor (Priest) on Apr 01, 2003 at 13:40 UTC | |
by Jaap (Curate) on Apr 01, 2003 at 20:03 UTC | |
by thor (Priest) on Apr 01, 2003 at 20:47 UTC | |
by Jaap (Curate) on Apr 02, 2003 at 09:35 UTC | |
by thor (Priest) on Apr 02, 2003 at 12:44 UTC | |
|
Re: Idea for XPath implementation
by BrowserUk (Patriarch) on Apr 02, 2003 at 10:30 UTC |