AW: [xslt] Streaming XPath compilation in xsltXPathCompile()



Hi,

> Im Auftrag von Kasimier Buchcik
> Gesendet: Mittwoch, 12. April 2006 22:07

[...]

> --> xmlCompileStepPattern (Libxml2, pattern.c)
> where we hit the following:
> if (i >= ctxt->nb_namespaces) {
> 	ERROR5(NULL, NULL, NULL,
> 		"xmlCompileStepPattern : no namespace bound to prefix
> %s\n",
> 
> A way to fix this would be to feed the xmlXPathContext with
> the current in-scope namespaces. *But*, on the other side,
> this will generate a copy of all the given in-scope namespaces
> in xmlXPathTryStreamCompile(); I'm not sure if we want a copy
> of such a list for every compiled expression. So I really don't know
> would be the optimal solution here.
> 
> If there was a chance of adjusting xmlXPathTryStreamCompile() to *not*
> to copy the list (maybe per context option), then this would be the
> ideal solution, I think.

I noticed that xmlCompileStepPattern() performs an additional copy of
the namespace name:
for (i = 0;i < ctxt->nb_namespaces;i++) {
  if (xmlStrEqual(ctxt->namespaces[2 * i + 1], prefix)) {
    URL = xmlStrdup(ctxt->namespaces[2 * i]);
    break;
  }
}
So we end up copying the namespaces names twice.

I vote for a namespace-dict here - containing namespace names and
prefixes.
It could be shared by the stylesheets and the XPath processing
mechanisms.
This would also have a nice side-effect: if two ns-dicts are the same,
we could use pointer-comparison for namespace names in some places.

Regards,

Kasimier


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]