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

²éѯXMLÎĵµ

±êÇ©£ºÊý¾Ý·ÃÎÊ     ADO.NET
    ²éѯXMLÎĵµ     LINQ to XMLÀàÌṩÊôÐԺͷ½·¨£¬·µ»Ø¿É²éѯµÄÀàµÄ¶ÔÏ󼯺ϡ£
    ½«XML¶ÔÏó×÷ΪLINQ²éѯ¶ÔÏó£º
     .......
    XDocument customers = XDocument.Load(xmlFileName);
    var queryResult = from c in customers.Elements() select c.Name; 

    ʹÓòéѯ³ÉÔ±
        1£©Element()£º·µ»ØÎĵµ »ò Ƭ¶ÎÖеĵÚÒ»¸öÔªËØ¡£ÎĵµµÄ»°¾Í·µ»Ø¸ùÔªËØ£»         2£©Descendants()£º·µ»ØÎĵµ »ò Ƭ¶ÎÖеÄËùÓÐ×ÓÔªËØ£¨ËùÓм¶±ð£©£»             Àý£ºqueryResults = from c in customers.Descendants() select c.Name;                  foreach (var item in queryResults.Distinct()) //ɸѡ³ö²»Í¬µÄÔªËØ
                 Descendants(string)ÖØÔØ£º                  queryResults = from c in customers.Desendants("customer") select c;  //²éѯָ¶¨Ãû³ÆµÄ×ÓÔªËØ£¬·µ»ØËùÓÐcustomerÔªËØ¡£
        3£©Ancestors()£º·µ»Ø±ÈÔ´ÔªËؼ¶±ð¸ßµÄÒ»×éÔªËØ£»
        4£©Attribute()£º·µ»Øµ±Ç°Ñ¡ÖÐÔªËصÄËùÓÐÊôÐÔ£»
            Àý£ºqueryResults = from c in customers.Descendants("customer").Attributes() select c; //·µ»ØcustomersÖÐËùÓÐcustomerÔªËصÄÊôÐÔÖµ
              


Ïà¹ØÎĵµ£º

IsolatedStorageFile ±¾µØÊý¾Ý»º´æ xml dataset ¶Áд

IsolatedStorageFile£º°üº¬ÎļþºÍÊý¾ÝµÄ¶ÀÁ¢´æ´¢Çø
datasetÊý¾Ý´æ´¢µ½±¾µØxmlÎĵµ£¬´úÂë´¦ÀíÈçÏÂ
public static void WriteDataToXML(DataSet dataset, string dataname)
{
try
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForAssembly(); / ......

XML½âÎö¼¼Êõ

 XMLѧϰÍêÁË£¬ÀÏʦ˵ÔÚÃæÊÔµÄʱºòÓпÉÄÜÒªÎʵ½ÕâЩ£¬ËùÒÔÓÖÕÒÁËЩ×ÊÁÏ£¬ÔÚMLDNµÄÕâ¶ÎÈÕ×ÓÀÀÏʦÃǶ¼°Ñ¸÷¸öÃæÊÔÖÐÓпÉÄÜÒªÎʵ½µÄÎÊÌⶼ°ïÎÒÃÇÒ»Ò»×ܽᣬÕæµÄºÜ¸ÐлMLDNµÄÈ«²¿ÀÏʦ,ÏîÄ¿ÀÏʦ°ïÎÒÃÇÈÏÕæµÄ½²½âÏîÄ¿£¬¸¨µ¼ÏîÄ¿£¬½ÌѧÀÏʦ°ïÎÒÃÇÈÏÕæ×ܽá¸÷¸ö¼¼Êõ£¬¸Ðл£¬ÕæµÄÊǸÐл£¬ºÇºÇ£¬ÎÒ»áŬÁ¦¸ãºÃµÄ
JavaÖÐËÄÖÖXML ......

javascript¿çä¯ÀÀÆ÷´´½¨XML¶ÔÏó


var
 
xmlDoc
 
=
 
null
;
function
 
parseXML
(
xmlUrl
)
{
¡¡¡¡try
 
{
¡¡¡¡¡¡¡¡//IE
¡¡¡¡¡¡¡¡xmlDoc
 
=
 
new
 
ActiveXObject
(
"Microsoft.XMLDOM"
);
¡¡¡¡¡¡¡¡xmlDoc
.
async
 
=
 
false
;
¡¡¡¡¡¡¡¡xmlDoc ......

XML ¸ñʽ

ÏÖÔÚÎÒÃÇÔÝÇÒʹÓÓ¼Çʱ¾”À´´´½¨ÎÒÃǵÄXMLÎļþ°É¡£ÏÈ¿´Ò»¸öXMLÎļþ£º 
¡¡¡¡Àý1 
¡¡¡¡¡´?xml version="1.0" encoding="gb2312" ?¡µ 
¡¡¡¡¡´²Î¿¼×ÊÁÏ¡µ 
¡¡¡¡ ¡´Êé¼®¡µ 
¡¡¡¡ ¡´Ãû³Æ¡µXMLÈëÞ«½â¡´/Ãû³Æ¡µ 
¡¡¡¡ ¡´×÷Õß¡µÕÅÈý¡´/×÷Õß¡ ......

XmlÖÐSelectSingleNode·½·¨ÖеÄxpathÓ÷¨

×î³£¼ûµÄXMLÊý¾ÝÀàÐÍÓУºElement, Attribute£¬Comment, Text.  
 
   Element, Ö¸ÐÎÈç<Name>Tom<Name>µÄ½Úµã¡£Ëü¿ÉÒÔ°üÀ¨£ºElement, Text, Comment, ProcessingInstruction, CDATA, and EntityReference.  
 
   Attribute, Ö¸ÔÚ<Employee >ÖеĴ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ