LoadXml:从指定的字符串加载 XML 文档。

eg:doc.LoadXml("<root>aa</root>");

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

       public void LoadXmlTest() {
// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<item><name>wrench</name></item>"); // Add a price element.
XmlElement newElem = doc.CreateElement("price");
newElem.InnerText = "10.95";
doc.DocumentElement.AppendChild(newElem); XmlNode xmlNode = doc.SelectSingleNode("/item/name");
Console.WriteLine(xmlNode.InnerText);
xmlNode = doc.SelectSingleNode("/item/price");
Console.WriteLine(xmlNode.InnerText); // Save the document to a file and auto-indent the output.
XmlTextWriter writer = new XmlTextWriter("data.xml", null);
writer.Formatting = Formatting.Indented;
doc.Save(writer);
}

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Load:加载指定的 XML 数据

XmlDocument.Load (Stream)从指定的流加载 XML 文档。
XmlDocument.Load (String) 从指定的 URL 加载 XML 文档。
XmlDocument.Load (TextReader) 从指定的 TextReader 加载 XML 文档。
XmlDocument.Load (XmlReader)从指定的 XmlReader 加载 XML 文档。

        public void getInfo(string fileName)
{
//创建XML的根节点
// CreateXMLElement();
string fileFullPath = Application.StartupPath + "\\" + fileName;
Console.WriteLine(fileFullPath);
XmlDocument doc = new XmlDocument();
doc.Load(fileFullPath); XmlNodeList xmlNodeList = doc.SelectNodes("/root/business/item");
foreach (XmlNode xmlNode in xmlNodeList)
{
Console.WriteLine(string.Format("{0}\t{1} \n{2}", xmlNode.Attributes["BusinessName"].Value, xmlNode.Attributes["DistinctionKey"].Value, xmlNode.Attributes["Url"].Value));
} Console.ReadLine();
}
 
http://msdn.microsoft.com/zh-cn/library/system.xml.xmldocument.loadxml(VS.80).aspx
 
 
 

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

XmlDocument.LoadXml和Load的区别的更多相关文章

  1. Hibernate中session.get()和session.load()的区别

    -- 翻译自https://www.mkyong.com/hibernate/different-between-session-get-and-session-load/ 很多时候你会发现,使用Hi ...

  2. Get和Load的区别----hibernate

    Get和Load的区别

  3. Hibernate的Session的get()和load()方法区别

    hibernate中Session接口提供的get()和load()方法都是用来获取一个实体对象,在使用方式和查询性能上有一些区别. get Session接口提供了4个重载的get方法,分别通过“持 ...

  4. 【转载】DOMContentLoaded与load的区别

    DOMContentLoaded与load的区别   (1)在chrome浏览器的开发过程中,我们会看到network面板中有这两个数值,分别对应网 络请求上的标志线,这两个时间数值分别代表什么? ( ...

  5. ready与load的区别

    JQuery里有ready和load事件 $(document).ready(function() { // ...代码... }) //document ready 简写 $(function() ...

  6. hibernate延迟加载(get和load的区别)

    概要: 在hibernate中我们知道如果要从数据库中得到一个对象,通常有两种方式,一种是通过session.get()方法,另一种就是通过session.load()方法,然后其实这两种方法在获得一 ...

  7. jQuery document window load ready 区别详解

    用过JavaScript的童鞋,应该知道window对象和document对象,也应该听说过load事件和ready事件,小菜当然也知道,而且自认为很了解,直到最近出了问题,才知道事情并不是那么简单. ...

  8. body里面的onload和window.onload,window.load的区别

    区别:body里面的onload是在“页面加载完成后执行的动作”window里面的onload是在“页面加载时执行的动作” window.load这个应该只是表明事件方法,但并未执行,比如click表 ...

  9. Hibernate中get()和load()方法区别

    get和load方式是根据id取得一个记录下边详细说一下get和load的不同,因为有些时候为了对比也会把find加进来. 1.从返回结果上对比:load方式检索不到的话会抛出org.hibernat ...

随机推荐

  1. daylyknowledge1

    1.数据库截取字符串:toFixed():四舍五入substring(cp_introduce,0,11) cp_introduce前台截取: field: 'an_content', title: ...

  2. ASP.NET基于NPOI导出数据

    using System; using System.Collections; using System.Collections.Generic; using System.IO; using Sys ...

  3. My Site Cleanup Job

    解决办法: The My Site of Linda Wang ??? is scheduled for deletion in 3 days. As their manager you are no ...

  4. NTP服务器配置

    #/etc/ntp.conf# driftfile /var/lib/ntp/ntp.drift logfile /var/log/ntpd.log statistics loopstats peer ...

  5. 【OCP-12c】CUUG 071题库考试原题及答案解析(15)

    15.(6-24)choose the best answerExamine the structure of the MEMBERS table:You want to display detail ...

  6. “全栈2019”Java第三章:安装开发工具IntelliJ IDEA

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  7. vue 动态组件

    动态组件 多个组件通过同一个挂载点进行组件的切换,is的值是哪个组件的名称,那么页面就会显示哪个组件 内置组件 (内置组件不会被渲染到页面上) component is属性     keep-aliv ...

  8. Wannafly挑战赛29题解

    这套题目非常有意思啊23333--话说为啥没有上条先生的呢-- 传送门 \(A\) 御坂美琴 蠢了--首先先判总共加起来等不等于\(n\),不是的话就不行 然后dfs记录\(n\)不断分下去能分成哪些 ...

  9. matlab中显示灰阶图像

    matlab的数据源文件中400张图片,每张图片是一个112*92的矩阵表示,而400张图片存储在一个cell数组ime中,显示第一张图片,指令是: colormap(gray) imagesc(im ...

  10. Python内置函数查询表——总结篇

    Python3.5版本中的68个内置函数,按顺序逐个进行了自认为详细的解析,现在是时候进行个总结了.为了方便记忆,将这些内置函数进行了如下分类:     数学运算(7个)     类型转换(24个) ...