lxml: add namespace to input file

后端 未结 6 1561
不思量自难忘°
不思量自难忘° 2020-12-03 21:16

I am parsing an xml file generated by an external program. I would then like to add custom annotations to this file, using my own namespace. My input looks as below:

6条回答
  •  醉话见心
    2020-12-03 21:31

    You could replace the root element to add 'kjw' to its nsmap. Then xmlns declaration would be only in the root element.

提交回复
热议问题