我有以下格式的XML:
我想根据客户的姓名对客户列表进行排序,并以以下格式返回文档:
我正在使用C#,目前使用的是XmlDocument。
谢谢。
<?xml version="1.0" encoding="utf-8"?>
<contactGrp name="People">
<contactGrp name="Developers">
<customer name="Mike" ></customer>
<customer name="Brad" ></customer>
<customer name="Smith" ></customer>
</contactGrp>
<contactGrp name="QA">
<customer name="John" ></customer>
<customer name="abi" ></customer>
</contactGrp>
</contactGrp>
我想根据客户的姓名对客户列表进行排序,并以以下格式返回文档:
<?xml version="1.0" encoding="utf-8"?>
<contactGrp name="People">
<contactGrp name="Developers">
<customer name="Brad" ></customer>
<customer name="Mike" ></customer>
<customer name="Smith" ></customer>
</contactGrp>
<contactGrp name="QA">
<customer name="abi" ></customer>
<customer name="John" ></customer>
</contactGrp>
</contactGrp>
我正在使用C#,目前使用的是XmlDocument。
谢谢。
xpath
标签... 如果您想选择一个节点集,则XPath可能是正确的技术。 如果您想正确排序节点集,则需要XPath引擎主机语言。 但是,如果您想转换XML树,则标准资源是XSLT。 - user357812contactGrp
元素。 :) - Dimitre Novatchev