Re: [libxml++] xpath with namespaces



I am able to successfully parse the file using both the DOMParser and
the SaxParser, so I don't believe there is an error.  If you want to
take a look at the file it is at:

http://www.gentoo.org/rdf/en/glsa-index.rdf

Thanks,
Curtis


On Sun, 05 Dec 2004 20:27:55 +0100, Murray Cumming <murrayc murrayc com> wrote:
> On Sat, 2004-12-04 at 19:51 -0800, Curtis Spencer wrote:
> > Hi,
> >
> > I saw this post sometime in July, and now I am running into the same
> > problem.  Does anyone have an answer for this?
> 
> So can you answer my question?
> 
> Is there actually an error in the document?
> 
> 
> 
> >  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
> >
> > 
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real users.
> > Discover which products truly live up to the hype. Start reading now.
> > http://productguide.itmanagersjournal.com/
> > _______________________________________________
> > Libxmlplusplus-general mailing list
> > Libxmlplusplus-general lists sourceforge net
> > https://lists.sourceforge.net/lists/listinfo/libxmlplusplus-general
> --
> Murray Cumming
> murrayc murrayc com
> www.murrayc.com
> www.openismus.com
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Libxmlplusplus-general mailing list
> Libxmlplusplus-general lists sourceforge net
> https://lists.sourceforge.net/lists/listinfo/libxmlplusplus-general
>




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