如何对一xml格式的字符串分析?
http://topic.csdn.net/t/20021102/16/1142056.html
use classes in System.Xml namespace, for example (assume your xml is in string s and it contains an xmlns definition):
<ns:vi id="New_main" xmlns:ns="whatever">
<ns:node Expandable="checkOnce" Selected="true" ID="a1">
root<ns:node ID="a2">
Node1
</ns:node>
</ns:node>
</ns:vi>
string s = "................";
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(s);
XmlNamespaceManager xnm = new XmlNamespaceManager(xmldoc.NameTable);
xnm.AddNamespace("ns","whatever");
XmlNode node = xmldoc.SelectSingleNode("//ns:node[@ID='a1']", xnm);
if (node != null)
{
XmlAttribute att = xmldoc.CreateAttribute("bbi");
att.Value = "xxxxxxxxxxx";
node.Attributes.Append(att);
}
相关文档:
/*
* history
*
* Created on 2003-5-26
*
* 2003-06-05
* 1.增加了Log的处理信息。
* 2.抛出的异常由原来UtilException的改变成XMLException,后者继承前者。
*
* 2003-09-02 by David Yu
* 1.增加了改变一个 ......
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Syste ......
HTML - Hyper Text Mark-up Language - 超文本标记语言
HTML-超文本标记语言,是WWW的描述语言。设计HTML语言的目的是为了能把存放在一台电脑中的文本或图形与另一台电脑中的文本或图形方便地联系在一起,形成有机的整体,人们不用考虑具体信息是在当前电脑上还是在网络的其它电脑上。我们只 ......
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 ......
xml文件如下:<?xml version="1.0" encoding="gb2312"?>
<软件管理系统>
<管理员>
<用户名>明日科技</用户名>
<密码>123456</密码>
<地址>长春市</地址>
</管理员>
<管理员>
<用户名>明日软件</用户名 ......