[Twisted-Python] Help using XmlStreamFactory & XmlStream : XPathQuery error?
Ralph Meijer
twisted at ralphm.ik.nu
Wed Feb 20 05:34:16 EST 2008
On Tue, 2008-02-19 at 15:48 +0100, Gabriel Rossetti wrote:
> Christopher Zorn wrote:
> >
> >
> > On Feb 19, 2008 8:54 AM, Jean-Paul Calderone <exarkun at divmod.com
> > <mailto:exarkun at divmod.com>> wrote:
> >
> > On Tue, 19 Feb 2008 12:29:38 +0100, Gabriel Rossetti
> > <mailing_lists at evotex.ch <mailto:mailing_lists at evotex.ch>> wrote:
> > > [snip]
> > >Ok, I've got some code sort of working, if I use the following
> > XPathQuery
> > >string : "/*" on the following XML string :
> > >
> > ><?xml version="1.0" encoding="utf-8"?>
> > ><test><feed name="test">toto</feed></test>
> > >
> > >the addObserver works ( xs.addObserver("/*", self.onTest) )
> > >but if I try the following :
> > >
> > >
> > >xs.addObserver("/test/feed/@name", self.onTest)
> > >or
> > >xs.addObserver(xpath.XPathQuery("/test/feed/@name"), self.onTest)
> > >
> >
> > I don't think the xpath implementation in xish is complete. You may
> > have found a bug or a case it doesn't handle.
> >
> >
> > It is not complete. But if you would like to find the stanza 'feed'
> > with the attribute 'name' then it would like like
> >
> > xs.addObserver("/test/feed[@name]", self.onTest)
> >
> >
> Ok, thanks (Jean-Paul & Christopher), that helped, I though I was doing
> something wrong :-). So there is no way of directly getting the stanza's
> attribute's value using the xpath implementation in xish? I can use the
> getAttribute() method but "pure" xpath would be nicer.
See the other mail for a more complete answer to why the XPath
implementation is like it is.
Indeed the XPath implementation is far from complete. It shouldn't yield
that particular error though, I think. Could you file a ticket for this
specific case?
--
Groetjes,
ralphm
More information about the Twisted-Python
mailing list