Re: [xml] Obtaining a string result from an XPATH function?



On Sun, Mar 17, 2002 at 11:54:57AM -0800, Horst wrote:
Hi, 
Perhaps this is not even possible, but I'm wondering how to get the
string result from an XPATH expression in my C code.
  xmlXPathInit();

  doc = xmlParseFile("foo.xml");
  if (doc == NULL) 
    return -1;

  ctxt = xmlXPathNewContext(doc);     
  obj  = xmlXPathEvalExpression("strcat(THIS,THAT)", ctxt); 

  Hum ...  you're strcat'ing empty nodesets... it's
           xmlXPathEvalExpression("strcat('THIS','THAT')", ctxt);

Is there a problem with my expression?

  yes it's #1 XPath pittrap.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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