I was not clear about idea behind xpath exists. It's not part of XPath
specification. The purpose of this function is checking XML document if will
return values on specified XPath expression. (Only check, not evaluate result).
But someone was faster and this code will apear in PostgreSQL 9.1.
xpathobj = xmlXPathCompiledEval(xpathcomp, xpathctx);
if (xpathobj == NULL) /* TODO: reason? */
xml_ereport(ERROR, ERRCODE_INTERNAL_ERROR,
"could not create XPath
object");
/* return empty array in cases when nothing is found */
if (xpathobj->nodesetval == NULL)
*res_nitems = 0;
else
*res_nitems = xpathobj->nodesetval->nodeNr;
I am not sure if xmlXPathCompiledEval is best way to check for values. Someone
suggest xmlXPathCompiledEvalToBoolean so any suggestions are welcome.
I would like to use xpath exists as core function for a new Index on XML
documents. Just now studing possibilities of serializing whole xmlDocPtr and
reuse it when needed. Is any plan to for indexing in LibXML2?
P.S. http://veillard.com/XML/search.php return private informations about DB,
user names etc
# ------------ Původní zpráva ------------
# Od: Daniel Veillard <[email protected]>
# Komu: Tomáš Pospíšil<[email protected]>,
# Kopie: <[email protected]>,
# Předmět: Re: [xml] xpath exists
# Datum: 24.3.2011 16:43:34
# ----------------------------------------
# On Thu, Mar 24, 2011 at 03:48:25PM +0100, Tomáš Pospíšil wrote:
# > I'm going to implement xpath exist function in PostgreSQL, where LibXML
# > is in use. Can anybody suggest how achieve that with LibXML functions
# > (fastest way and in memory) ?
#
# Hum, what does it do. It's not in XPath 1.0 , seems to be in 2.0
# though but I don't know it...
#
# Daniel
#
# --
# Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
# [email protected] | Rpmfind RPM search engine http://rpmfind.net/
# http://veillard.com/ | virtualization library http://libvirt.org/
#
#
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml