Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#СTip£ºXml²Ù×÷¼òÃ÷ÊÖ²á 3

3£©¶ÁÈ¡¡¢²éÕÒ
µ±ÄãÊÖÍ·ÓÐÒ»¸öxmlÎļþºó£¬¿ÉÒÔʹÓÃXmlDocument.Load()·½·¨½«Æä¼ÓÔؽøÀ´ÒԱ㴦Àí£¬ËùÒÔ“¶ÁÈ¡”ûÓÐʲô¿É˵µÄ¡£¶ø“²éÕÒ”²Ù×÷ÍùÍùÉæ¼°XPath£¬ÕâÀïÖ»ÊÇÎÒÈÏΪµÄ±È½Ï³£Óõ½µÄ²éÕÒ²Ù×÷£¬XPathÕâÍæÒâʵÔÚÊǺÜÇ¿´óºÜ±©Á¦¡£
 
»ØÍ·¿´Ê¾ÀýÎĵµxmlsample.xml£¬ÎÒÃÇ¿ÉÄÜÓöµ½ÕâÑùµÄÐèÇó£º
£¨A£©²éÕÒ¸èÇú“Hurt”µÄÑݳªÕߣ¿
£¨B£©²éÕÒÁ÷ÅÉΪ“R&B”µÄ¸èÇúÃû³Æ£¿
£¨C£©²éÕÒ·¢ÐÐÄê·ÝÔÚ2004ÒÔÇ°µÄ¸èÇúµÄÑݳªÕߣ¿
£¨D£©µ¹ÊýµÚ¶þÊ׸èµÄ¸èÇúÃû³Æ£¿
 
Õë¶ÔÉÏÊöÎÊÌ⣬Ä㵱Ȼ¿ÉÒÔͨ¹ýµÝ¹é±éÀú¸÷½áµãÀ´²éÕÒ£¬²»¹ýʹÓÃXPath½«ÊǸüΪ¸ßЧµÄ·½°¸£º
ÎÊÌ⣨A£©
Code
XmlDocument doc = new XmlDocument();
doc.Load("xmlsample.xml");
//    
XmlNodeList xnl = doc.SelectNodes("/music/song[@title='Hurt']/artist");
foreach (XmlNode n in xnl)
{
     Console.WriteLine(n.InnerText);
}
£¨ÒÔ“/”ÆðʼµÄ·¾¶±Ø¶¨ÊǾø¶Ô·¾¶£¬¼´´Ó¸ùÔªËØÆ𡣶ø¶ÔÊôÐÔµÄÒýÓÃÇ°ÃæÒª¼Ó“@”£©
 
ÎÊÌ⣨B£©
Code
XmlDocument doc = new XmlDocument();
doc.Load("xmlsample.xml");
//
XmlNodeList xnl = doc.SelectNodes("/music/song[genre='R&B']");
foreach (XmlNode n in xnl)
{
    if (n is XmlElement)
     {
         Console.WriteLine(((XmlElement)n).GetAttribute("title"));
     }
}
£¨²»Í¬ÓÚ¶ÔÊôÐÔµÄÒýÓ㬶Ô×Ó½ÚµãµÄÒýÓò»ÐèҪʹÓÓ@”£©
 
ÎÊÌ⣨C£©
Code
XmlDocument doc = new XmlDocument();
doc.Load("xmlsample.xml");
//
XmlNodeList xnl = doc.SelectNodes("/music/song[year<2004]/artist");
foreach (XmlNode n in xnl)
{
     Console.WriteLine(n.InnerText);
}
£¨ÊýÖµÒ»Ñù¿ÉÒԱȽϡ££©
 
ÎÊÌ⣨D£©
Code
XmlDocument doc = new XmlDocument();
doc.Load("xmlsample.xml");
//
XmlNode n = doc.SelectSingleNode("/music/song[last()-1]");
if (n is XmlElement)
{
     Console.WriteLine(((XmlElement)n).GetAttribute("title"));
}
£¨¾ßÓÐһϵÁеÄÄÚÖú¯Êý£¬Èçlast()¡¢po


Ïà¹ØÎĵµ£º

c# ´ÓXML¶ÁÊý¾Ý

C#
 DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/Config/User_yhlx_Jb.xml"));
DataView dv = ds.Tables[0].DefaultView;
//dv.RowFilter = "State=0";
this.DropDownList1.DataSource = dv;
this.DropDownList1.DataTextField = "text";
this ......

XML Schema ²Î¿¼ÊÖ²á1

XML Schema ²Î¿¼ÊÖ²á
XSD ÔªËØ
ÔªËØ
½âÊÍ
all
¹æ¶¨×ÓÔªËØÄܹ»ÒÔÈÎÒâ˳Ðò³öÏÖ£¬Ã¿¸ö×ÓÔªËؿɳöÏÖÁã´Î»òÒ»´Î¡£
annotation
annotation ÔªËØÊÇÒ»¸ö¶¥²ãÔªËØ£¬¹æ¶¨ schema µÄ×¢ÊÍ¡£
any
ʹ´´×÷Õß¿ÉÒÔͨ¹ýδ±» schema ¹æ¶¨µÄÔªËØÀ´À©Õ¹ XML Îĵµ¡£
anyAttribute
Ê ......

XML Schema °ïÖúÎĵµ4

XML Schema import ÔªËØ
¶¨ÒåºÍÓ÷¨
import ÔªËØÓÃÓÚÏòÒ»¸öÎĵµÌí¼Ó´øÓв»Í¬Ä¿±êÃüÃû¿Õ¼äµÄ¶à¸ö schema¡£
ÔªËØÐÅÏ¢
³öÏÖ´ÎÊý
ÎÞÏÞÖÆ
¸¸ÔªËØ
schema
ÄÚÈÝ
annotation
Óï·¨
<import
id=ID
namespace=anyURI
schemaLocation=anyURI
any attributes
>
(annotation?)
< ......

³õѧXML£¨¶þ£© XML½âÎöÆ÷

XML½âÎöÆ÷µÄ×÷ÓãºÎªÓ¦ÓóÌÐò´ÓXMLÎļþÖнâÎö³öËùÐèÒªµÄÊý¾Ý¡£
ÏÂÃæͨ¹ýÒ»¸öÀý×Ó£¬À´Á˽⣬ÈçºÎÓÃXML½âÎöÆ÷£¬À´½âÎöÒ»¸öXMLÎļþÖеÄÊý¾Ý¡£
1¡¢Types.xml£¨ÏÔʾ¼ªËûµÄÀà±ð£©
<?xml version="1.0" encoding="UTF-8"?>
<types>
<name>µç¼ªËû
<music>ÍæÒ¡¹ö</music>
</name>
......

.net(c#)¶ÁÈ¡flash(swf)ÎļþµÄ³ß´ç

ÓÃÁ˱ðÈ˵ĴúÂ룬ÍƼö+±¸Íü¡£
Ô­ÌûµØÖ·£º
.net(c#)¶ÁÈ¡flash(swf)ÎļþµÄ³ß´ç
http://www.cnblogs.com/nasdaqhe/archive/2008/07/02/1234357.html
ÓÃ.NET¶ÁÈ¡Flash¸ñʽÎļþÐÅÏ¢
http://www.cnblogs.com/gmm/archive/2007/07/17/310675.html
ÎÒʹÓÃÁ˵ÚÒ»¸öÌû×ÓÖеĴúÂ룬µÚÒ»¸öÌû×ӵĴúÂë²Î¿¼µÄÊǵڶþ¸öÌû×Ó£º£©
The ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ