XmlDocument.LoadXML+如何构造xml字符串
http://topic.csdn.net/u/20080905/10/caea1689-4582-417a-8723-d008a3ae1a10.html?550638422
tringBuilder sb = new StringBuilder();
sb.Append(" <?xml version=\"1.0\"?> ");
sb.Append(" <root> ");
sb.Append(" <test value=\"| \"/> ");
sb.Append(" </root> ");
XmlDocument d = new XmlDocument();
try
{
d.LoadXml(sb.ToString());
MessageBox.Show("OK");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
d = null;
sb = null;
}
相关文档:
详细介绍Flex中操作XML(上)
2009年12月30日 星期三 12:05
一 在介绍Flex中操作XML之前,首先简单介绍下XML中的基本术语。
元素:XML中拥有开始标签和结束标签的这一块称为“元素”
节点:把XML元素与文本结合起来统称为节点
根节点:位于整个XML文 ......
1.添加命名空间引用
using System.Xml;
2.新建xml实例
public XmlDocument objXmlDoc = new XmlDocument();
3.加载Xml文档
string path=Server.Mappath("demo.xml");//得到文档路径
objXmlDoc.Load(path);//加载文档
4.查找要进行操作的结点
objXmlDoc.SelectNodes(xpath);//得到结点集合
objXmlDoc.SelectSingleN ......
大家都知道在SQL Server中利用 FOR XML PATH 语句能够把查询的数据生成XML数据,下面是它的一些应用示例。
DECLARE @TempTable table(UserID int , UserName nvarchar(50));
insert into @TempTable (UserID,UserName) values (1,'a')
insert into @TempTable (UserID,UserName) values (2,'b')
select UserID, ......
这个例子要把bookstore.xml文件增加一条book记录
1 bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="love" ISBN="1234123">
<title>who am i </title>
<author>who</author>
  ......
接上一篇
显示所有结点的内容
1 原xml文件 bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book ISBN="1234123">
<title>who am i </title>
<author>who</author>
<price> ......