[Twisted-Python] Help using XmlStreamFactory & XmlStream : XPathQuery error?

Gabriel Rossetti mailing_lists at evotex.ch
Tue Feb 19 09:48:46 EST 2008


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.

Gabriel
>  
>
>
>     Jean-Paul
>
>     _______________________________________________
>     Twisted-Python mailing list
>     Twisted-Python at twistedmatrix.com
>     <mailto:Twisted-Python at twistedmatrix.com>
>     http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>   





More information about the Twisted-Python mailing list