On 4/4/07,
Nikolay Samokhvalov <
nikolay@samokhvalov.com> wrote:
So, choosing between two inefficient approaches:
1. mine, which in some cases use dummy element wrapping, that we could escape;
2. proposed by you, which leads to +1 parsing.
... I'd definitely choose the first one.
I'd make it a bit more clear.
We have different cases for XML value as input of xpath():
a. document with prolog ('<?xml...')
b. document w/o prolog (value that can be represented as a tree -- i.e. we have one root)
c. fragment with one root element (can be represented as a tree)
d. fragment w/o root element (cannot be represented as a tree, e.g. 'bla'::xml)
So, the current implementation works w/o wrapping in case a) and use wrapping for cases b)-d).
But we _need_ wrapping _only_ in case d) -- so there is space for optimization (I would keep bit "this value is not a tree" in the value itself).
--
Best regards,
Nikolay