[lxml-dev] Setting default namespace
Stefan Behnel
stefan_ml at behnel.de
Sat Feb 16 08:18:13 CET 2008
Hi,
Fabien wrote:
> I've a document with a namespace of the root element of my document
> and when I display an element .tag, I get it with the namespace. Also,
> when I'm using xpath(), I need to use the namespaces={..}) parameters.
> Is there a way to define a default namespace in order to manipulate
> the document like if it hasn't namespace ?
No. Because a namespaced name is different from a non-namespaced name.
Take a look at the E factory and lxml.objectify, if you want some more magic
at the API level.
http://codespeak.net/lxml/tutorial.html#the-e-factory
http://codespeak.net/lxml/objectify.html
http://codespeak.net/lxml/objectify.html#tree-generation-with-the-e-factory
Stefan
More information about the lxml-dev
mailing list