[英]Reading complex XML file in c#
我有一个 XML 文件,我想阅读它并在列表中显示我的 xml 的某些部分:
<collection>
<source/>
<date/>
<key/>
<document>
<id>AIMed_d30</id>
<passage>
<offset>0</offset>
<text>Isolation of human delta-catenin and its binding specificity with presenilin 1. We screened proteins for interaction with presenilin (PS) 1, and cloned the full-length cDNA of human delta-catenin. </text>
<annotation id="T1">
<infon key="file">ann</infon>
<infon key="type">protein</infon>
<location length="13" offset="19"/>
<text>delta-catenin</text>
</annotation>
<relation id="R4">
<infon key="relation type">Interaction</infon>
<infon key="file">ann</infon>
<infon key="type">Relation</infon>
<node role="Arg1" refid="T12"/>
<node role="Arg2" refid="T13"/>
</relation>
</passage>
</document>
起初我想阅读整个 xml 文件,然后我想显示部分:“collection/document/id/passage/annotation/text”并将其他部分保存在字符串中。 我搜索了网络和 stackoverflow,但它对我没有帮助,也没有得到我想要的答案。
如果你能帮助我,我将不胜感激。
您可以使用XmlDocument
类来读取和保存 XML 文档。 它在System.Xml
。
在此处阅读更多相关信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.