XML文件绑定数据集控件操作
//数据绑定
public void DataBind()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(@"App_data/dbGuest.xml"));
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
}
//添加
public void XmlDataAdd()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(@"App_data/dbGuest.xml"));
DataRow dr = ds.Tables[0].NewRow();
dr["Name"] = "spark";
dr["City"] = "tokyo";
dr["Email"] = "jis@163.com";
dr["Message"] = "thank you";
dr["STime"] = DateTime.Now.ToString();
ds.Tables[0].Rows.Add(dr);
ds.WriteXml(Server.MapPath(@"App_data/dbGuest.xml"));
}
dbGuest.xml
<?xml version="1.0" standalone="yes"?>
<dbGuest xmlns="http://tempuri.org/dbGuest.xsd">
<User>
<Name>shaoazhd</Name>
<City>beijing</City>
<Email>sss@22.net</Email>
<Message>afsa</Message>
</User>
<User>
&
相关文档:
http://stackoverflow.com/questions/1112828/cannot-decode-string-with-wide-characters-appears-on-a-weird-place
http://man.ddvip.com/web/xmlzhzn/xml_cn/xml_encoding.asp.htm
http://bbs.xml.org.cn/dispbbs.asp?boardID=8&ID=7226
http://topic.csdn.net/t/20030909/13/2240153.html
#
http://www.ezloo. ......
本文系转载,谨向转载处空间拥有者及源出处文章作者表示感谢!
转载处:http://henry19890701.javaeye.com/blog/481462
源出处:http://www.ziliaonet.com/tech/netprogramme/XML/200605/69398.html
在做一般的XML数据交换过程中,我更乐意传递XML字符串,而不是格式化的XML Document。这就涉及到XML字符串和Xml Docume ......
1.route.xml文件内容
<?xml version="1.0" encoding="GBK"?>
<root>
<route id="1111">
<id>111</id>
<name>四川</name>
<path>www.baidu.com/hehe.html</path>
</route>
</root>
2.test.html代码
<html>
<body>
<script> ......
在html文件中嵌入的代码如下:
<script type="text/javascript">
var xmlUrl="news.xml";
var swfURL="news.swf";
var img_Speed=2;
var page_Speed=3000;
var TextPosition="down";
var HeadlineColor="#ff0000";
var HeadlineFont="14px";
va ......