asp.net²Ù×÷XMLС½á
Ò»¡¢¼òµ¥½éÉÜ
using System.Xml;
//³õʼ»¯Ò»¸öxmlʵÀý
XmlDocument xml=new XmlDocument();
//µ¼ÈëÖ¸¶¨xmlÎļþ
xml.Load(path);
xml.Load(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));
//Ö¸¶¨Ò»¸ö½Úµã
XmlNode root=xml.SelectSingleNode("/root");
//»ñÈ¡½ÚµãÏÂËùÓÐÖ±½Ó×Ó½Úµã
XmlNodeList childlist=root.ChildNodes;
//ÅжϸýڵãÏÂÊÇ·ñÓÐ×Ó½Úµã
root.HasChildNodes;
//»ñȡͬÃûͬ¼¶½Úµã¼¯ºÏ
XmlNodeList nodelist=xml.SelectNodes("/Root/News");
//Éú³ÉÒ»¸öнڵã
XmlElement node=xml.CreateElement("News");
//½«½Úµã¼Óµ½Ö¸¶¨½ÚµãÏ£¬×÷ΪÆä×Ó½Úµã
root.AppendChild(node);
//½«½Úµã¼Óµ½Ö¸¶¨½ÚµãÏÂij¸ö×Ó½ÚµãÇ°
root.InsertBefore(node,root.ChildeNodes[i]);
//Ϊָ¶¨½ÚµãµÄн¨ÊôÐÔ²¢¸³Öµ
node.SetAttribute("id","11111");
//Ϊָ¶¨½ÚµãÌí¼Ó×Ó½Úµã
root.AppendChild(node);
//»ñÈ¡Ö¸¶¨½ÚµãµÄÖ¸¶¨ÊôÐÔÖµ
string id=node.Attributes["id"].Value;
//»ñÈ¡Ö¸¶¨½ÚµãÖеÄÎı¾
string content=node.InnerText;
//±£´æXMLÎļþ
string path=Server.MapPath("~/file/bookstore.xml");
xml.Save(path);
//or use :xml.Save(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));
¶þ¡¢¾ßÌåʵÀý
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlelem ;
1£¬´´½¨µ½·þÎñÆ÷ͬÃûĿ¼ÏµÄxmlÎļþ£º
·½·¨Ò»£º
xmldoc = new XmlDocument ( ) ;
//¼ÓÈëXMLµÄÉùÃ÷¶ÎÂä,<?xml version="1.0" encoding="gb2312"?>
XmlDeclaration xmldecl;
xmldecl = xmldoc.CreateXmlDeclaration("1.0","gb2312",null);
xmldoc.AppendChild ( xmldecl);
//¼ÓÈëÒ»¸ö¸ùÔªËØ
xmlelem = xmldoc.CreateElement ( "" , "Employees" , "" ) ;
xmldoc.AppendChild ( xmlelem ) ;
//¼ÓÈëÁíÍâÒ»¸öÔªËØ
for(int i=1;i<3;i++)
{
XmlNode root=xmldoc.SelectSingleNode("Employees");//²éÕÒ<Employees>
XmlElement xe1=xmldoc.CreateElement("Node");//´´½¨Ò»¸ö<Node>½Ú
Ïà¹ØÎĵµ£º
¶ÔÓÚasp.net,ĬÈÏÖ»ÔÊÐíÉÏ´«2MÎļþ,Ôö¼ÓÈçÏÂÅäÖÃ,Ò»°ã¿ÉÒÔ×Ô¶¨Òå×î´óÎļþ´óС.
<httpRuntime executionTimeout="300" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"/>
ÎÒÃÇÔÚÉÏ´«´óÎļþʱ¶¼Óöµ½¹ýÕâÑù»òÄÇÑùµÄÎÊÌâ¡£ÉèÖúܴóµÄmaxRequestLengthÖµ²¢²»ÄÜÍê ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Practi ......
AtlasÊÇʲô£¿
atlas 2006-12-12 09:48 ÔĶÁ69 ÆÀÂÛ0
×ֺţº ´ó´ó ÖÐÖРСС
AtlasÊÇʲô£¿
ASP.NET”Atlas”ÊÇÒ»¸öеÄWeb¼¼Êõ¿ª·¢°ü£¬Ëü¼¯³ÉÁËÒ»Ì׷dz£´óµÄ¿Í»§¶Ë½Å±¾¿âʹµÃÓ빦ÄܷḻµÄ¡¢»ùÓÚ·þÎñÆ÷¿ª·¢Æ½Ì¨µÄASP.NET2.0½áºÏÔÚÒ»Æð£¬&rdq ......
Ò»¡¢ÈçºÎ£ºÊ¹Óà ASP.NET Óï·¨½«·þÎñÆ÷¿Ø¼þÌí¼Óµ½ ASP.NET ÍøÒ³
¿ÉÒÔͨ¹ýÔÚ .aspx ÎļþÖÐÖ±½ÓÉùÃ÷ Web ·þÎñÆ÷¿Ø¼þ½«ËüÌí¼Óµ½Ò³ÖС£
ÒÔÉùÃ÷·½Ê½Ìí¼Ó¿Ø¼þ
A¡¢Èç¹ûÄúλÓÚ¿ÉÊÓ»¯Éè¼ÆÆ÷ÖУ¬ÇëÇл»µ½Ô´±à¼ÊÓͼ¡£
B¡¢½«±íʾ¸Ã¿Ø¼þµÄÔªËؼüÈë .aspx Îļþ¡£ÄúʹÓõľßÌåÓ﷨ȡ¾öÓÚÒªÌí¼ÓµÄ¿Ø¼þ£¬ ......
ËÄ¡¢ÈçºÎ£ºÖ¸¶¨ÊÇ·ñ½« ASP.NET Web ·þÎñÆ÷¿Ø¼þ·¢Ë͵½·þÎñÆ÷
ĬÈÏÇé¿öÏ£¬Óû§ÔÚ ASP.NET ÍøÒ³ÖÐÖ¸¶¨µÄÐÅÏ¢ºÍÑ¡Ôñ²»»áÁ¢¼´·¢Ë͵½·þÎñÆ÷¡£¶øÊÇÖ»ÔÚ·¢ËÍÕû¸öҳʱ·¢ËÍÖµ£¬²¢ÇÒͨ³£ÊÇÔÚÏìÓ¦°´Å¥µ¥»÷ʱ·¢Éú¡£µ«ÊÇ£¬Äú¿ÉÄܻᷢÏÖËüÔÚÏò·þÎñÆ÷Á¢¼´·¢ËÍÓû§¸ü¸Äʱ·Ç³£ÓÐÓá£
Á¢¼´½«¿Ø¼þÖµ·¢Ë͵½·þÎ ......