在下面的 XML 文件中,需要一起使用的元素在XElements
. (这超出了我的控制)。例如,我想ToolVersion
与Result
.
<DiagReport>
<LicensingData>
<ToolVersion>6.3.9431.0</ToolVersion>
<LicensingStatus>SL_LICENSING</LicensingStatus>
</LicensingData>
<Health>
<Result>PASS</Result>
<TamperedItems></TamperedItems>
</Health>
<Genuine>
<ServerProps>GenuineId</ServerProps>
</Genuine>
</DiagReport>
我知道如何从这篇文章中获得最深的孩子,但这会一一迭代。在上面的示例中,我可能需要ToolVersion
and Result
,但随后需要回到LicensingStatus
,并从我离开的地方继续。(代码不需要明确地忽略Result
,因为我可以在我的switch
语句中忽略它。
这可能吗?