如何使用 C# 从 XML 文件中删除所有空元素?
例如:
输入
<Person>
<PersonDetails>
<Name>Some Name</Name>
<Address>
<Street>Some Street</Street>
<City>Some City</City>
<Zip/>
</Address>
</PersonDetails>
<PersonDetails>
<Name>Some Name</Name>
<Address/>
</PersonDetails>
<PersonDetails/>
</Person>
输出
<Person>
<PersonDetails>
<Name>Some Name</Name>
<Address>
<Street>Some Street</Street>
<City>Some City</City>
</Address>
</PersonDetails>
<PersonDetails>
<Name>Some Name</Name>
</PersonDetails>
</Person>