[fpc-devel] XML / SAX - Removing redundancies

Sergei Gorelkin sergei_gorelkin at mail.ru
Wed Mar 12 19:23:24 CET 2014


12.03.2014 21:46, Daniel Gaspary пишет:
> On Wed, Mar 12, 2014 at 2:36 PM, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>> What can be achieved at the most seems to be the parsing of the expression
>> and the resulting parse tree.
>
> Is exactly what I'm trying to say(my lack of English grammar skills
> doesn't help). :)
>
>> I seriously doubt this is doable, since XPath works directly on the DOM tree
>> ?
>
> Is possible if TXmlReader keeps track of the it's current path. Let's say:
>
> TMyXmlReader = class(TXmlTextReader)
> private
>           FPath: TStrings; //or another dedicated new CLass to keep a
> list of nodes.
> public
>          Register(XPathExpression: string; MethodToCall);
> end;
>
> At each step of processing, FPath is updated and is compared to XPathExpression.

A certain subset of expressions (forward iteration only) can be handled that way, yes.
But in general, XPath requires a source with non-sequential access.

Regards,
Sergei



More information about the fpc-devel mailing list