[xml] XPath with no XML Doc



Hi

Apologies in advance for a potentially silly (and over-long) question...

One of the test documents I'm using to test my integration of libxml into
our program consists of XPath statements with no associated XML Document.
The purpose of this test is to check the format of the results from XPath
statements and to act as a regression test against out old hand-coded XML /
XPath implementation.

[Sidetrack: In effect our test doc fires XPath statements like
"string(0123.4560)" or "substring-after('13/10/2000','/')" or "1 div
round(-0.49)" into the XPath processor (either libxml or our original one),
and check the values are the same / correct. We have a different doc to test
the node set functions, with an associated XML doc.]

Anyway, what I wanted to check was is there any way to get XPath to work
without creating a dummy XML document for the statements to work against?
If I create an XPath context with a NULL document and try using it, I get
the following error:
C:\src\xml\libxml\xpath.c:9855 Internal error: no document
I noticed that the testxpath prog always parses the built in XML document
and uses that if one isn't specified.

In theory, there isn't any need for the Internal error to be generated
unless the XPath statement requires access to an XML document (e.g. for node
set functions), and it seems unnecessary to create an empty dummy document
just to use a few simple XPath statements.

Have I missed anything obvious, or should I start tweaking the XPath code?

Thanks,
Richard





_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




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