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

C#操作xml

引用命名空间:using System.Xml 
1.检查所要操作的xml文件是否存在:
   System.IO.File.Exists(文件路径及名称);
2.得到xml文件:
(1)在asp.net中可以这样得到:
XmlDocument xmlDoc = new XmlDocument();
//导入xml文档
xmlDoc.Load( Server.MapPath("xmlTesting.xml"));
//导入字符串
//xmlDoc.LoadXml("<bookStore> <book id="01" price="3.5元"> 读者</book></bookStore>");
注:Server.MapPath("xmlTesting.xml")此时的xmlTesting.xml文件必须是在当前的解决方案里;同样可以写成完整的物理路径xmlDoc.Load (@"E:"软件学习"测试"myNoteWeb"xmlTesting.xml")
(2)在windForm中 直接用物理路径得到所要操作的xml文件具体实现方法同上
3.创建xml文件:
 XmlDocument xmlDoc = new XmlDocument(); //创建xml文档(实例化一个xml)
XmlNode root = xmlDoc.CreateElement("bookStore");//创建根节点
//创建第1个子结点:
XmlNode bookNode = xmlDoc.CreateElement("book");
bookNode.InnerText = "读者";
//为此节点添加属性
 法1:
 bookPublishNode.SetAttribute("id", "01")
 root.AppendChild(bookNode);
法2:
 XmlAttribute xmlattribute = tempXmlDoc.CreateAttribute("price");
 xmlattribute.Value = "3.5元";
 tempRoot .Attributes .Append (xmlattribute )
 //创建第2个根节点的子结点:
 XmlNode tempBookNode = xmlDoc.CreateElement("tempbook ");
 tempBookNode.InnerText ="文摘";
 root.AppendChild(tempBookNode);


相关文档:

C#开发实例

c#改变系统鼠标
---------------------------------------------------------------------------------------------------
using System.Runtime.InteropServices;
 
[DllImport("User32.DLL")]
public static extern bool SetSystemCursor(IntPtr hcur, uint id);
public const uint OCR_NORMAL = 32512;
publ ......

RFC访问SAP(C#)


using System.Windows.Forms;
using SAPFunctionsOCX;
using SAPLogonCtrl;
using SAPTableFactoryCtrl;
namespace SAPFunction
{
    public partial class Form1 : Form
    {
        public Form1()
       ......

使用c#开发mapserver之六styleObj

styleObj用于设置图层的符号。它在classObj中定义,一般于symbolObj一起使用。通过设置styleObj,可以产生千变万化,丰富多彩的地图。
一个简单的styleObj示例:
CLASS
NAME "Primary Roads"
STYLE
SYMBOL "circle"
COLOR 178 114 1
SIZE 15
END #style1
STYLE
SYMBOL "circle"
COLOR 254 161 0
SIZE 7
END #s ......

C# 加密-散列算法

创建散列码的方法非常多,即使是同一种散列算法也可以通过许多类来实现,前面章节介绍的算一种,下面再介绍一种。以 SHA1
为例:
string plaintext = "明文";
byte[] srcBuffer = System.Text.Encoding.UTF8.GetBytes(plaintext);
HashAlgorithm hash = HashAlgorithm.Create("SHA1"); //将参数换 ......

C# 连接Oracle数据库


C#连接Oracle数据库字符串
http://developer.51cto.com
 2009-08-20 17:55  佚名  百度空间  我要评论(
0
)
C#连接Oracle数据库以及C#连接Oracle数据库字符串等内容将在本文中展现,希望本文能对大家了解C#连接数据库有所帮助。
C#连接Oracle数据库字符串(查询数据)
using
 Syst ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号