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

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

×î³£¼ûµÄXMLÊý¾ÝÀàÐÍÓУºElement, Attribute£¬Comment, Text.  
 
   Element, Ö¸ÐÎÈç<Name>Tom<Name>µÄ½Úµã¡£Ëü¿ÉÒÔ°üÀ¨£ºElement, Text, Comment, ProcessingInstruction, CDATA, and EntityReference.  
 
   Attribute, Ö¸ÔÚ<Employee >ÖеĴÖÌ岿·Ö¡£  
 
   Comment£¬Ö¸ÐÎÈ磺<!-- my comment --> µÄ½Úµã¡£  
 
   Text£¬Ö¸ÔÚ<Name>Tom<Name>µÄ´ÖÌ岿·Ö¡£  
 
  ÔÚXMLÖУ¬¿ÉÒÔÓÃXmlNode¶ÔÏóÀ´²ÎÕÕ¸÷ÖÖXMLÊý¾ÝÀàÐÍ¡£  
 
   2.1 ²éѯÒÑÖª¾ø¶Ô·¾¶µÄ½Úµã£¨¼¯£©  
 
   objNodeList = objDoc.SelectNodes(“Company/Department/Employees/Employee”)  
 
  »òÕß  
 
   objNodeobjNodeList = objNode.SelectNodes(“/Company/Department/Employees/Employee”)  
 
  ÒÔÉÏÁ½ÖÖ·½·¨¿É·µ»ØÒ»¸öNodeList¶ÔÏó£¬Èç¹ûÒª·µ»Øµ¥¸ö½Úµã¿ÉʹÓÃSelectSingleNode·½·¨£¬¸Ã·½·¨Èç¹û²éѯµ½Ò»¸ö»ò¶à¸ö½Úµã£¬·µ»ØµÚÒ»¸ö½Úµã£»Èç¹ûûÓвéѯµÄÈκνڵ㷵»Ø Nothing¡£ÀýÈ磺  
 
   objNodeobjNode = objNode.SelectSingleNode(“/Company/Department/Employees/Employee”)  
 
   If Not (objNode is Nothing) then  
 
   ‘- Do process  
 
   End If  
 
   2.2 ²éѯÒÑÖªÏà¶Ô·¾¶µÄ½Úµã£¨¼¯£©  
 
  ¿ÉʹÓÃÀàËÆÓÚÎļþ·¾¶µÄÏà¶Ô·¾¶µÄ·½Ê½À´²éѯXMLµÄÊý¾Ý  
 
   objNode = objDoc.SelectSingleNode(“Company/Department”)  
 
   objNodeobjNodeList = objNode.SelectNodes(“../Department)  
 
   objNodeobjNode = objNode.SelectNode(“Employees/Employee”)  
 
   2.3 ²éѯÒÑÖªÔªËØÃûµÄ½Úµã£¨¼¯£©  
 
  ÔÚʹÓò»¹æÔòµÄ²ã´ÎÎĵµÊ±£¬ÓÉÓÚ²»ÖªµÀÖмä²ã´ÎµÄÔªËØÃû£¬¿ÉÊ


Ïà¹ØÎĵµ£º

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

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

DataSet XMl DateTable »¥×ª

/// <summary>
/// DataTable-------------------->XML --String
/// </summary>
public static String ToXmlString(DataTable dt)
{
StringWriter tr = new StringWriter();
try
{
dt.WriteXml(tr); ......

¡°XML DOM¶ÁÈ¡½ÚµãÐÅÏ¢¡±Ð¡½á

<?
XML DOM¶ÁÈ¡½ÚµãÐÅÏ¢Óöµ½ÎÊÌâ×ܽ᣺  
 
1:NodeList: ʹÓýڵãµÄchildNodesÊôÐÔ»òÕßdocument¶ÔÏóµÄgetElementsByTagName()·½·¨£¬¾Í»á·µ»ØÒ»¸ö°üº¬½ÚµãÁбíµÄNodeList
 
2: ÔÚ XML DOM ÖУ¬½ÚµãµÄ¹Øϵ±»¶¨ÒåΪ½ÚµãµÄÊôÐÔ£º
·  parentNode
·  childNodes
· ......

ÔõôÑùÔÚÍøÒ³É϶ÁÈ¡Ô¶³ÌxmlµÄÊý¾Ý

 ±¾ÎÄת×Ô£ºhttp://www.10086web.com/html/wangluobiancheng/Xmlbiancheng/2009/0612/90.html
Ò»¸ö¿Í»§Ìṩһ¸ö¹É¼ÛµÄÐÅÏ¢£¬ÒªÇó·ÅÔÚÒ³ÃæÉÏ£¬ÏÔʾһЩÊý¾Ý£¬ÐèÒª´ÓÔ¶³Ì»ñÈ¡xml£¬È»ºó½âÎöдÔÚÍøÒ³ÉÏ£¬¿ªÊ¼²»»á¾õµÃºÜÄÑ£¬ÆäʵÂù¼òµ¥µÄ£¬ÏÈÓÃjavascriptдÁËÒ»¸ö£º
<mce:script language=javascript><!--

......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ