From: togol m. <tog...@ly...> - 2005-10-16 11:46:25
|
Dear Members, I am facing the problem of finding nodes in an OWL file. The importance of = registering the namespace before calling the find() function has been discu= ssed before, but still the find function in libxml++ v2.12 does not support= this. I defined a new function as follows. NodeSet Node::find_with_ns(const std::string& xpath, const std::string& ns_= prefix, const std::string& uri) const { xmlXPathContext* ctxt =3D xmlXPathNewContext(impl_->doc); if (!xmlXPathRegisterNs(ctxt, (const xmlChar*)ns_prefix.c_str(), (const x= mlChar*)uri.c_str())){ std::cout << "Namespace registered successfully" << std::endl; } ctxt->node =3D impl_; ...=20 The "undefined namespace prefix" error message does not appear anymore, but= the node set is still empty. I call the find() function for the root node = rdf:RDF of the owl document with the XPath expr //owl:Ontology. If I add a = check to see whether the OWL namespace is already registered using xmlSearc= hNs(), it returns the namespace pointer since for OWL, the namespace is alw= ays defined in the root node.=20 Can somebody please point out where the problem is? =20 Thanks, Togol=20=20=20 --=20 _______________________________________________ Search for businesses by name, location, or phone number. -Lycos Yellow Pa= ges http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.as= p?SRC=3Dlycos10 |