Discussion:
How to construct element with non-default XML namespace?
Felix Schwarz
2013-09-10 15:20:27 UTC
Permalink
I want to build an Element (genshi.builder) which renders exactly to this string
u'<ns1:foo xmlns:ns1="http://example.com"/>'

but the closest I can get to is:
Element('http://example.com}ns1:foo')
which results in
u'<ns1:foo xmlns="http://example.com"/>'

Is it possible to specify different namespaces in Genshi's Element?

fs
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/groups/opt_out.
Simon Cross
2013-09-15 09:51:50 UTC
Permalink
Element("ns1:foo", **{"xmlns:ns1": "http://example.com"})

Seems to do what you want. It's a bit clumsy but maybe that's okay.
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/groups/opt_out.
Felix Schwarz
2013-09-17 08:46:32 UTC
Permalink
Post by Simon Cross
Element("ns1:foo", **{"xmlns:ns1": "http://example.com"})
Seems to do what you want. It's a bit clumsy but maybe that's okay.
Thanks, that did the trick indeed. Stupid me.

fs
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...