如何获取XElement
的值而不获取其子元素?
以下是一个示例:
<?xml version="1.0" ?>
<someNode>
someValue
<child>1</child>
<child>2</child>
</someNode>
如果我使用XElement.Value来获取<someNode>
,我将得到字符串"somevalue<child>1</child><child>2<child>"
,但我只想获得"somevalue"而不是包含"<child>1</child><child>2<child>"
的子串。