如果我有一个包含命名空间的XML文件,如:
<root>
<h:table xmlns:h="http://www.namespaces.com/namespaceOne">
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table>
<h:table xmlns:h="https://www.namespaces.com/namespaceTwo">
<h:name>African Coffee Table</f:name>
<h:width>80</f:width>
<h:length>120</f:length>
</h:table>
</root>
我想将所有名称空间提升到root元素,如下所示:
<root xmlns:h="http://www.namespaces.com/namespaceOne" xmlns:h1="https://www.namespaces.com/namespaceTwo">
<h:table>
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table>
<h1:table>
<h1:name>African Coffee Table</f:name>
<h1:width>80</f:width>
<h1:length>120</f:length>
</h1:table>
</root>
有什么方法可以做到?