Andrew Z schrieb am 07.03.2018 um 05:03: > Hello, > with 3.6 and latest greatest lxml: > > from lxml import etree > > tree = etree.parse('Sample.xml') > etree.register_namespace('','http://www.example.com')
The default namespace prefix is spelled None (because there is no prefix for it) and not the empty string. > causes: > Traceback (most recent call last): > File "/home/az/Work/flask/tutorial_1/src/xml_oper.py", line 16, in > <module> > etree.register_namespace('','http://www.example.com') > File "src/lxml/etree.pyx", line 203, in lxml.etree.register_namespace > (src/lxml/etree.c:11705) > File "src/lxml/apihelpers.pxi", line 1631, in lxml.etree._tagValidOrRaise > (src/lxml/etree.c:35382) > ValueError: Invalid tag name '' > > partial Sample.xml: > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> > > <Applications xmlns="http://www.example.com"> > <Application> > <Customer email="ja...@acme.com" external_id="ABCDZ2002" > md_status_nonpro="true" type="INDIVIDUAL" prefix="jadoe"> > > <cut here> > > it seems to not be happy with the empty tag . > But i'm not sure why and how to go about it. Could you explain why you want to do that? Stefan -- https://mail.python.org/mailman/listinfo/python-list