¶ÁдxmlËùÓнڵã¸öÈËС½á ºÍ ¶ÁÈ¡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")
{
&n
Ïà¹ØÎĵµ£º
DOM³õ²½
DOMÊÇDocument Object ModelµÄËõд£¬¼´Îĵµ¶ÔÏóÄ£ÐÍ¡£Ç°Ãæ˵¹ý£¬XML½«Êý¾Ý×é֯Ϊһ¿ÅÊ÷£¬ËùÒÔDOM¾ÍÊǶÔÕâ¿ÅÊ÷µÄÒ»¸ö¶ÔÏóÃèÐð¡£Í¨Ë×µÄ˵£¬¾ÍÊÇͨ¹ý½âÎöXMLÎĵµ£¬ÎªXMLÎĵµÔÚÂß¼ÉϽ¨Á¢Ò»¸öÊ÷Ä£ÐÍ£¬Ê÷µÄ½ÚµãÊÇÒ»¸ö¸ö¶ÔÏó¡£ÎÒÃÇͨ¹ý´æÈ¡ÕâЩ¶ÔÏó¾ÍÄܹ»´æÈ¡XMLÎĵµµÄÄÚÈÝ¡£
ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£¬¿´¿´ÔÚDOMÖ ......
import java.awt.Image;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
public class createXml
{
public static boolean writeXml(String path,String dir,String wpath,String wname)
{
File[] files = ReaderListFiles(path);
boo ......
ÉϴΰÑÊý¾Ý¿â·ÃÎÊÀ๲Ïí³öÀ´ÁË£¬¼¸¸öͬÊÂÍøÉϸп®ÁËÒ»·¬£¬ÕæµÄûÓÐÏëµ½ÎÒ»¹±£Áô5ÄêÇ°µÄ´úÂ룬ÎÒ˵£¬´úÂë±¾À´¾ÍÊÇÓ¦¸Ã±»ÔĶÁºÍÑо¿µÄ£¬´úÂëͬÑù¾ßÓÐ˼ÏëºÍÇé½Ú£¬Õâ¾ÍÊÇÔÚÒ»Çî¶þ°×µÄÇé¿öϵÄÀúÊ·ºÍ¹ì¼£¡£ÅäÖùÜÀíͬÑùÒ²ÊÇһλ¾¡Ö°µÄÊ·¹Ù¡£
×ܽáһϣ¬Éϴθø³öµÄ´úÂë ......
Ò». ²»Í¬XML¸ñʽÉϵIJîÒì
<Bil BilID="09120005">
<Product PID="XS000-3">
<Package Needuan="10"/>
<Package Needuan="8"/>
</Product>
</Bil>
Óë
<channel>
<title>Meerkat: An Open2 Wire Service</title>
<link>http://meerkat. ......
½üÀ´×Ô¼ºÔÚ×öxmlµÄ½âÎöÆ÷¡£ÀûÓõ½ÁËcmarkupÀ࣬¾Íµ±×ö´æ´¢°É£¡ÓÐÐèÒªµÄÅóÓÑ¿ÉÒÔÃ鼸ÑÛ¡£
HTREEITEM itemTemp1,itemTemp2;
CString str1,str2;
char strtemp[100];
static bool result = true;
strtemp[0] = 0;
if (result)
{
xml.FindElem();
}
&nbs ......