【发布时间】:2018-05-16 11:44:49
【问题描述】:
我想生成带有属性 xsi:noNamespaceSchemaLocation 的元素。
<Test name="Name" xsi:noNamespaceSchemaLocation="anyURI"></a>
我的python代码
import xml.etree.ElementTree as xml
root = xml.Element('Tests', xsi:noNamespaceSchemaLocation="anyURI")
当我尝试运行 python 文件时。报错
文件“.../xml-generator.py”,第 4 行 root = xml.Element('Tests', xsi:noNamespaceSchemaLocation="anyURI") ^ SyntaxError: 无效语法
【问题讨论】:
标签: xml python-3.x xml-parsing