我正在使用 BeautifulSoup 来解析 XML 文档。是否有一种直接的方法来获取文档中使用的不同元素名称的列表?
例如,如果这是文档:
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to> Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Run Code Online (Sandbox Code Playgroud)
我想得到:注意,到,从,标题,正文