ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйý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>½Úµã
xe1.SetAttribute("genre","ÀîÔÞºì");//ÉèÖøýڵãgenreÊôÐÔ
xe1.SetAttribute("ISBN","2-3631-4");//ÉèÖøýڵãISBNÊôÐÔ
XmlElement xesub1=xmldoc.CreateElement("title");
xesub1.InnerText="CS´ÓÈëÃŵ½¾«Í¨";//ÉèÖÃÎı¾½Úµã
xe1.AppendChild(xesub1);//Ìí¼Óµ½<Node>½ÚµãÖÐ
XmlElement xesub2=xmldoc.CreateElement("author");
xesub2.InnerText="ºò½Ý";
xe1.AppendChild(xesub2);
XmlElement xesub3=xmldoc.CreateElement("price");
xesub3.InnerText="58.3";
xe1.AppendChild(xesub3);
root.AppendChild(xe1);//Ìí¼Óµ½<Employees>½ÚµãÖÐ
}
//±£´æ´´½¨ºÃµÄXMLÎĵµ
xmldoc.Save ( Server.MapPath("data.xml") ) ;
//////////////////////////////////////////////////////////////////////////////////////
½á¹û£ºÔÚͬÃûĿ¼ÏÂÉú³ÉÁËÃûΪdata.xmlµÄÎļþ£¬ÄÚÈÝÈçÏ£¬
<?xml version="1.0" encoding="gb2312"?>
<Employees>
<Node genre="ÀîÔÞºì" ISBN="2-3631-4">
<title>CS´ÓÈëÃŵ½¾«Í¨</title>
<author>ºò½Ý</author>
<price>58.3</price>
&l
Ïà¹ØÎĵµ£º
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйýXML²Ù×÷,Ï£ÍûÏÂÃæÕâƪÎÄÕÂÄܶԴó¼ÒÓаïÖú.»òÕß×Ô¼º¸´ÖÆһϴúÂëÊÔÒ»ÏÂ.ÕâƪÎÄÕ²»ÊÇÎÒдµÄ.ÎÒÖ»ÊÇת¹ýÀ´.¾õµÃ²»´í.
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlelem ;
1£¬´´½¨µ½·þÎñÆ÷ͬà ......
¸Õ¿ª²©²»¾Ã,¾ÍºÜÏëдµã¶«Î÷,µ«ÊdzöÓÚÖÖÖÖÔÒò¶¼Ã»¶¯ÊÖ¡£ÓÐÁ˲©¿Í×ܲ»ÄÜ¿Õ×Å£¬¾ÍÔÚ×ÁÄ¥×ÅдЩʲô¡£¸ÕºÃѧϰÁË×Ö·û´®µÄһЩ¶«Î÷£¬×öÁËϱʼǸоõ»¹²»´í£¬ÄóöÀ´É¹É¹...
ÏÈ˵˵×Ö·û´®²Ù×÷µÄÐÔÄÜÎÊÌâ¡£C#ÖеÄ×Ö·û´®²Ù×÷£¬ÓõÃÒ²±È½Ï¶à£¬´ó¼Ò¶¼²»Ä°Éú¡£·´Õý¾ÍÊÇÉùÃ÷Ò»¸ö×Ö·û´®±äÁ¿£¬È»º ......
c# ÖÐ isºÍas ²Ù×÷·ûÊÇÓÃÀ´½øÐÐÇ¿ÖÆÀàÐÍת»»µÄ
is : ¼ì²éÒ»¸ö¶ÔÏóÊÇ·ñ¼æÈÝÓÚÆäËûÖ¸¶¨µÄÀàÐÍ,²¢·µ»ØÒ»¸öBoolÖµ,ÓÀÔ¶²»»áÅ׳öÒì³£
object o = new object();
if (o is Label)
{
Label lb = (Label)o;
Response.Write("ÀàÐÍת»»³É¹¦");
}
else
{
Response.Write(" ......
1£©
XMLÊÇÒ»ÏîÈÈÃŵļ¼Êõ¡£ËüÖ®ËùÒÔÄܹ»ÒýÆðÈËÃǵÄÐËȤ£¬Ò»¸öÖ÷ÒªµÄÔÒòÔÚÓÚËüÊ®·ÖµÄ¼òµ¥£¬ÈËÃÇ¿ÉÒÔºÜÈÝÒ×µØÀí½âºÍʹÓÃËü¡£Ã¿Ò»¸ö³ÌÐòÔ±¶¼ÄÜÇáÒ׵ؿ´¶®Ò»¸öXMLÎļþ£¬Àí½âËü°üº¬µÄÄÚÈÝ¡£
.NETÖаüº¬Á˺ܶàÖ§³ÖXMLµÄÀ࣬ÕâЩÀàʹµÃ³ÌÐòԱʹÓÃXML±à³Ì¾ÍÈçͬÀí½âXMLÎļþÒ»Ñù¼òµ¥¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒ½«¸ø³öÕâÑùµÄÒ»¸öÀàµÄʹÓÃʾ ......
ÉÏƪÎÄÕÂÖÐ˵µ½Ê²Ã´ÊÇ Cache¶ÔÏó£¬ÈçºÎÔÚASP.NETÖÐʹÓà Cache¶ÔÏó¡£ÏÂÃæÎÒÃÇÀ´ËµËµÈçºÎÔÚASP.NETÖÐɾ³ýÏî¡£
ASP.NET Cache ¶ÔÏóÉè¼ÆÓÃÓÚ±£Ö¤Ëü²¢²»Ê¹Óùý¶àµÄ·þÎñÆ÷ÄÚ´æ¡£½á¹ûÊÇ£¬µ±ÓÃÄÚ´æ±äµÃȱ·¦Ê±£¬Cache¶ÔÏó×Ô¶¯É¾³ý×îÉÙ±»Ê¹ÓõÄÏî¡£Äã¿ÉÒÔͨ¹ý¶¨Òåʱ¼äÏÞÖÆ¡¢ÒÀÀµÏî¡¢ÒÔ¼°Ïî
ÔÚCache¶ÔÏóÖеÄÓÅÏȼ¶À´Ó°Ïì Cache¶ÔÏó±£ ......