xml ¶Áд
¶Á£º
//´ò¿ªÄ³Îļþ(¼ÙÉèweb.configÔÚ¸ùĿ¼ÖÐ)
string filename=Server.MapPath("/") + @"WebApplication1\web.config";
XmlDocument xmldoc= new XmlDocument();
xmldoc.Load(filename);
//µÃµ½¶¥²ã½ÚµãÁбí
XmlNodeList topM=xmldoc.DocumentElement.ChildNodes;
foreach(XmlElement element in topM)
{
if(element.Name.ToLower()=="appsettings")
{
//µÃµ½¸Ã½ÚµãµÄ×Ó½Úµã
XmlNodeList nodelist=element.ChildNodes;
if ( nodelist.Count >0 )
{
//DropDownList1.Items.Clear();
foreach(XmlElement el in nodelist)//¶ÁÔªËØÖµ
{
//DropDownList1.Items.Add(el.Attributes["key"].InnerXml);
//this.TextBox2.Text=el.Attributes["key"].InnerText;
this.TextBox2.Text=el.Attributes["key"].Value;
this.Label1.Text=el.Attributes["value"].Value;
//ͬÑùÔÚÕâÀï¿ÉÒÔÐÞ¸ÄÔªËØÖµ,ÔÚºóÃæsave¡£
// el.Attributes["value"].Value=this.TextBox2.Text;
}
}
}
}
xmldoc.Save(filename);
ÔÚij½ÚµãÏÂÔö¼ÓÒ»¸öÔªËØ£¬²¢ÉèÖÃÖµ£º
if(element.Name.ToLower()=="appsettings")
{
XmlElement elem =xmldoc.CreateElement("add");
element.AppendChild(elem);
elem.InnerText="ltp";
xmldoc.Save(filename);
}
Ч¹û£º
<appSettings>
<add key="ÃÜÂë" value="admin" />
<add>ltp</add>
</appSettings>
ÔÚij½ÚµãÏÂÔö¼ÓÒ»¸öÔªËØ£¬²¢Ôö¼ÓÁ½¸öÊôÐÔ£º
if(element.Name.ToLower()=="appsettings")
{
XmlElement elem =xmldoc.CreateElement("add");
element.AppendChild(elem);
XmlAttribute xa=xmldoc.CreateAttribute("key");
xa.Value="ltp";
XmlAttribute xa2=xmldoc.CreateAttribute("value");
xa2.Value="first";
elem.SetAttributeNode(xa);
elem.SetAttributeNode(xa2);
xmldoc.Save(filename);
}
Ч¹û£º
<appSettings>
<add key="ÃÜÂë" value="admin" />
<add key="ltp" value="first" />
</appSettings>
//Ìí¼Ó¿ÕÔªËØ£º
XmlNode node=doc.CreateElement(groupname);
node.InnerText="";
doc.LastChild.AppendChild(node);
doc.Save(xmlfile);
ɾ³ýÒ»¸ö½ÚµãÔªËØ
string itemname=this.listBox1.SelectedItem.ToString();
this.listBox1.Items.Remove(this.listBox1.SelectedItem);
//begin del xmlfile
XmlDocument doc=new
Ïà¹ØÎĵµ£º
DECLARE @XMLdoc XML
SET @XMLdoc =
'<Book name="SQL Server 2000 Fast Answers">
<Chapters>
<Chapter id="1" name="Installation, Upgrades">
<CreateDate>2009-12-30</CreateDate>
</Chapter>
<Chapter id="2" name="Configuring SQL Server"/>
<Chapter i ......
¡¡¡¡inkfishÔ´´£¬ÇëÎðÉÌÒµÐÔÖÊתÔØ£¬×ªÔØÇë×¢Ã÷À´Ô´£¨http://blog.csdn.net/inkfish
£©¡£
¡¡¡¡PropertySet£¨À´Ô´£ºhttp://blog.csdn.net/inkfish£©
ÊÇÓÉopensymphony×éÖ¯¿ª·¢µÄµÄÒ»¸ö¿ªÔ´ÏîÄ¿£¬µ«ÊÇÄǸöÏîÄ¿ÎĵµÉÙ£¬³¤Ê±¼äûÓиüУ¬¹Ù·½Îĵµ´íÎóÆæ¶à£¬ËùÒÔÏÖÔÚÔÚÏîÄ¿ÖÐʹÓò¢²»¹ã·º¡£µ«Õâ²¢²»·Á°PropertySet³ÉΪһ¸öÓ ......
ÒýÑÔ
Èç¹ûÄãÒѾ¿´ÁËAsp.Net AjaxµÄÁ½ÖÖ»ù±¾¿ª·¢Ä£Ê½ ÕâƪÎÄÕ£¬Äã¿ÉÄܺܿì»á·¢ÏÖÕâÑùÒ»¸öÎÊÌ⣺ÔÚÄÇƪÎÄÕµķ½Ê½2ÖУ¬¿Í»§¶Ë½ö½öÊÇ·¢ËÍÁËÒ³ÃæÉÏÒ»¸öÎı¾¿òµÄÄÚÈݵ½·þÎñ¶Ë£¬¶ø·þÎñ¶ËµÄWeb·þÎñ·½·¨Ò²Ö»½ÓÊÕÒ»¸öÀ´×Ô¿Í»§¶ËµÄ×Ö·û´®ÀàÐ͵ÄÊýÖµ¡£¶øºÜ¶àʱºò£¬·þÎñ¶ËµÄ·½·¨ÆÚÍû½ÓÊÕµÄÊÇÒ»¸ö×Ô¶¨ÒåÀàÐÍ£¬»òÕßÊǶà¸ö²»Í¬ÀàÐ͵IJÎÊ ......
package book.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.Default ......
Ò»£®MsXml´´½¨XMLÎĵµÊ¾Àý
// XmlCreationDemo.cpp
#include <stdlib.h>
#include <stdio.h>
// ÒýÈëMSXML½âÎöÆ÷
#import <msxml4.dll>
using namespace MSXML2;
class InitializeCom
{
public:
InitializeCom() { CoInitialize(NULL); // Initializes the COM library }
~Initializ ......