我有一个类似于下面结构的 XML 文档。使用 Visual Basic 如何根据 Id 和名称在不同级别插入节点。
Xpath 允许我插入新节点还是只允许修改现有节点?例如,如果我想<BuildingPart Id="B012" Name="Bedroom" Type="Room"/>
在“B011 浴室”之后添加,如何实现?
<Buildings>
<BuildingPart Id="B001" Name="House">
<BuildingPart Id="B002" Name="Level 1" Type="Level">
<BuildingPart Id="B003" Name="Kitchen" Type="Room"/>
<BuildingPart Id="B004" Name="Bedroom" Type="Room"/>
<BuildingPart Id="B005" Name="Lounge" Type="Room"/>
<BuildingPart Id="B006" Name="Bathroom" Type="Room"/>
</BuildingPart>
<BuildingPart Id="B007" Name="Level 2" Type="Level">
<BuildingPart Id="B008" Name="Bedroom" Type="Room"/>
<BuildingPart Id="B009" Name="Bedroom" Type="Room"/>
<BuildingPart Id="B010" Name="Study" Type="Room"/>
<BuildingPart Id="B011" Name="Bathroom" Type="Room"/>
</BuildingPart>
</BuildingPart>
</Buildings>
谢谢。