易截截图软件、单文件、免安装、纯绿色、仅160KB

XML创建新结点

private void CreateNewXmlNode()
{
String strFileName = string.Empty;
strFileName = this.strCurrentPath + "System.xml";
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(strFileName);
XmlNode root = xmlDoc.SelectSingleNode("connect");
XmlElement xe1 = xmlDoc.CreateElement("Data2");
XmlElement xesub1 = xmlDoc.CreateElement("ServerType");
xesub1.InnerText = "SQLSERVER";
xe1.AppendChild(xesub1);
xesub1 = xmlDoc.CreateElement("Server");
xesub1.InnerText = "192.168.0.150";
xe1.AppendChild(xesub1);
xesub1 = xmlDoc.CreateElement("database");
xesub1.InnerText = "VirDinnerOfflineDB";
xe1.AppendChild(xesub1);
xesub1 = xmlDoc.CreateElement("UserID");
xesub1.InnerText = "sa";
xe1.AppendChild(xesub1);
xesub1 = xmlDoc.CreateElement("Password");
xesub1.InnerText = "1234";
xe1.AppendChild(xesub1);
root.AppendChild(xe1);
xmlDoc.Save(strFileName);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}


相关文档:

XML文档的显示 CSS

Product.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="product.css" ?>
<productata>
<product prodid="p001" category="toy">
<productname>Mini Bus</productname>
<description>This is a toy for childern aged 4 and above&l ......

XML与CSS ID选择符的使用

ID.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="ID.css"?>
<bookdetail>
<book class="A" id="B1">
<author>曹雪芹</author>
<title>红楼梦</title>
<price>60.00</price>
</book>
<book class="A ......

xml post(C#)

xmlpost by HttpWebRequest:
protected string PostXmlToURL(string url,string data)
{
    HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(url);
    hwr.Method = "POST";
    Stream stream = hwr.GetRequestStream();
    StreamWri ......

Xml文件操作和文件操作(FileInfo类)

Xml文件操作和文件操作(FileInfo类)
  1. 上传文件
 2. 写Xml文件
   3.  文件拷贝
 
 1. //上传
        protected void picUp_Click(object sender, EventArgs e)
        {
     ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号