linq to xml There are multiple root elements.
2024-09-08 15:05:01
添加xml结点的时候
var temp2 = temp1.Element("staticContent");
if (temp2 != null)
{
string str = "<remove fileExtension=\".svg\" />\r\n <mimeMap fileExtension=\".svg\" mimeType=\"image/svg+xml\" />\r\n <remove fileExtension=\".nupkg\" />\r\n <mimeMap fileExtension=\".nupkg\" mimeType=\"application/zip, application/octet-stream\" />\r\n <remove fileExtension=\".webm\" />\r\n <mimeMap fileExtension=\".webm\" mimeType=\"video/webm\" />\r\n <remove fileExtension=\".mp4\" />\r\n <mimeMap fileExtension=\".mp4\" mimeType=\"video/mp4\" />";
temp2.AddFirst(XElement.Parse(str));
}
必须把多个节点从,拆分开来,逐个添加
解析xml字符串的时候
[Test]
public void XmlTest()
{
string xml = "<Record ID=\"135\" Key=\"CustomTableItemID\" /> <Record ID=\"23\" Key=\"CustomTableID\" />";
XElement element = XElement.Parse(xml);
Console.WriteLine(element);
}
需要添加一个根结点,才能进行解析
最新文章
- python基础补漏-06-其他常用模块
- down的另一种用法
- TweenMax学习一
- UVa 1391 Astronauts (2SAT)
- Linxu 安装Scala
- python 字符串长度
- Flex 选项卡加载方式简介
- 零散的笔记:jquery中的事件
- 从零开始,使用python快速开发web站点(2)
- linux搭建phantomjs+webdriver+testng+ant自动化工程
- 使用Python对Excel进行读写操作
- 告知服务器意图的http方法
- 牛客小白月赛13 小A买彩票 (记忆化搜索)
- 奇异值分解(SVD)
- OGC标准服务 WMS WCS WFS WPS
- webvirtmgr-重命名kvm虚拟机的名称
- 基于Python项目的Redis缓存消耗内存数据简单分析(附详细操作步骤)
- 动态规划之132 Palindrome Partitioning II
- 【开源.NET】 轻量级内容管理框架Grissom.CMS(第二篇前后端交互数据结构分析)
- 【转】每天一个linux命令(54):ping命令