[libxml++] xpath with namespaces
- From: Curtis Spencer <thorin gmail com>
- To: libxmlplusplus-general lists sourceforge net
- Subject: [libxml++] xpath with namespaces
- Date: Sat, 4 Dec 2004 19:51:56 -0800
Hi,
I saw this post sometime in July, and now I am running into the same
problem. Does anyone have an answer for this?
Hello,
I"m trying to use XPaths on documents which use namespaces (e.g.
libxml++-2.6.1/examples/sax_exception/example.xml). My code looks like this:
xmlpp::DomParser dp;
dp.parse_file("example.xml");
xmlpp::Document* doc = dp.get_document();
xmlpp::Element* root = doc->get_root_node();
xmlpp::NodeSet set = root->find("//gjob:Jobs");
If I use "//gjob:Jobs" i get "XPath error : Undefined namespace prefix",
and "//Jobs" just returns an empty set.
I assume I have to register the namespace first, but I couldn"t find
anything about this in the documentation.
thanks in advance for your help.
Thomas Volpini
Thanks,
Curtis
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]