[Twisted-Python] t.w.x.d.Element serialization and default namespaces

Peter Sabaini peter at sabaini.at
Sun Jul 20 13:49:09 EDT 2008


Hi,

I'm trying to get to grips with Xish; and theres this annoying little problem: 
through a series of steps I'm getting at an Element who doesn't use the 
default namespace anymore, only some other NS. I am trying to make this other 
NS the default NS for serialization, but without much luck.

For example:

>>> from twisted.words.xish import domish
>>> e=domish.Element(("foons", "foo"), defaultUri="defuri", 
localPrefixes={"f":"foons"} )
>>> e.addElement(("foons", "bar"))
<twisted.words.xish.domish.Element object at 0x820840c>
>>> e.toXml()
u"<f:foo xmlns='defuri' xmlns:f='foons'><f:bar/></f:foo>"

I'd like the output to be something like "<foo><bar/></foo>" -- thats shorter 
and prettier.

Am I making any sense? Probably I'm missing something pretty obvious...

Thanks in advance,
peter.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20080720/d9adc948/attachment.pgp 


More information about the Twisted-Python mailing list