RT,看到一个程序有一个xml的操作是InnerText。说明上说是设置或获取节点的串联值。但是这个串联值是什么东西?
解决方案
40
英文叫concatenated values。另一种翻译就是,”连起来的值“,例如下例。
Pokemon是<name>的InnerText
Go是<action>的InnerText
<root>的InnerText就是Pokemon和Go的串联值 – PokemonGo。
Pokemon是<name>的InnerText
Go是<action>的InnerText
<root>的InnerText就是Pokemon和Go的串联值 – PokemonGo。
static void Main(string[] args)
{
string xml =
@"<root>
<name>Pokemon</name>
<action>Go</action>
</root>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string cat = doc.DocumentElement.InnerText; // PokemonGo
}