osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LXML: can't register namespace


Yes, if i give it any non empty tag - all goes well.

All im trying to do is to extract a namespace ( i try to keep simple here.
Just first one for now) and register it so i can save xml later on.


On Mar 7, 2018 00:38, "Steven D'Aprano" <
steve+comp.lang.python at pearwood.info> wrote:

> On Tue, 06 Mar 2018 23:03:15 -0500, Andrew Z wrote:
>
> > Hello,
> >  with 3.6 and latest greatest lxml:
> >
> > from lxml import etree
> >
> > tree = etree.parse('Sample.xml')
> > etree.register_namespace('','http://www.example.com')
>
> > it seems to not be happy with the empty tag . But i'm not sure why and
> > how to go about it.
>
> Have you tried using something other than the empty string?
>
> In the interactive interpreter, what does
>
> help(etree.register_namespace)
>
> say?
>
>
>
> --
> Steve
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>