Questions tagged «innerxml»

15
获得XElement的InnerXml的最佳方法?
body在下面的代码中获取混合元素内容的最佳方法是什么?该元素可能包含XHTML或文本,但是我只希望其内容为字符串形式。该XmlElement类型具有的InnerXml属性正是我所追求的。 编写的代码几乎可以实现我想要的功能,但是包含周围的<body>... </body>元素,这是我不需要的。 XDocument doc = XDocument.Load(new StreamReader(s)); var templates = from t in doc.Descendants("template") where t.Attribute("name").Value == templateName select new { Subject = t.Element("subject").Value, Body = t.Element("body").ToString() };
147 .net  xml  xelement  innerxml 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.