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

c#xml的增删改查


已知有一个XML文件(bookstore.xml)如下:  
  <?xml   version="1.0"   encoding="gb2312"?>  
  <bookstore>  
      <book   genre="fantasy"   ISBN="2-3631-4">  
          <title>Oberon's   Legacy</title>  
          <author>Corets,   Eva</author>  
          <price>5.95</price>  
      </book>  
  </bookstore>  
     
  1、往<bookstore>节点中插入一个<book>节点:  
        XmlDocument   xmlDoc=new   XmlDocument();  
        xmlDoc.Load("bookstore.xml");  
        XmlNode   root=xmlDoc.SelectSingleNode("bookstore");//查找<bookstore>  
        XmlElement   xe1=xmlDoc.CreateElement("book");//创建一个<book>节点  
        xe1.SetAttribute("genre","李赞红");//设置该节点genre属性  
        xe1.SetAttribute("ISBN","2-3631-4");//设置该节点ISBN属性  
     
        XmlElement   xesub1=xmlDoc.CreateElement("title");  
        xesub1.InnerText="CS从入门到精通";//设置文本节点  
        xe1.AppendChild(xesub1);//添加到<book>节点中  
        XmlElement   xesub2=xmlDoc.CreateElement("author");  
        xesub2.InnerText="候捷";  
        xe1.AppendChild(xesub2);  
        XmlElement   xesub3=xmlDoc.CreateElement("price");  
        xesub3.InnerText="58.3";  
        xe1.AppendChild(xesub


相关文档:

String和Xml之间的转换、String转InputStream

通常在操作xml的时候,都是通过inputstream(很多情况下是FileInputStream)来读入xml并转为dom的,很多人会遇到这种情况数据不是从文件读入的而是从String中取得的
于是会使用
InputStream in = new ByteArrayInputStream (str.getBytes());来取得inputstream ,但是这种InputStream中数据被转成了byte数组,所以转dom ......

C#中对XML节点进行增删改查

号称xmlhelper的一个类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XML文档操作管理器
/// </summary>
public class XMLHelper
{
public X ......

C#中使用DataTable显示Access数据库中文件列表


private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
             this.comboBox2.Items.Clear();
            switch(this.comboBox1.SelectedIndex)
       ......

C#读写Access数据库的OLE对象字段

(一)把文件内容写入Access数据库的OLE对象字段中:
if (File.Exists(txtBrow.Text) != false)   // 文本框txtBrow中内容为文件路径及文件名
{
     //获取文件后缀
     FileInfo p = new FileInfo(txtBrow.Text.Trim());
     F_str_Type = ......

如何在JavaScript访问C#函数?


1.如何在JavaScript访问C#函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按钮,在后台将调用或处理的内容写入button_click中;
          2、在前台写一个js函数,内容为document.getElementById("btn1").click();
   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号