万卷书   首页 > 电脑书籍 > Web服务器 > Web服务中的异常处理(4)
 
   XmlNamespaceManagernsManager=new

   XmlNamespaceManager(doc.NameTable);

   //AddthenamespacetotheNamespaceManager

   nsManager.AddNamespace("errorNS",

   "http://tempuri.org/CategoriesService");

   XmlNodecategoryNode=

   doc.DocumentElement.SelectSingleNode("errorNS:Error",

   nsManager);

   stringerrorNumber=

   categoryNode.SelectSingleNode("errorNS:ErrorNumber",

   nsManager).InnerText;

   stringerrorMessage=
   categoryNode.SelectSingleNode("errorNS:ErrorMessage",

   nsManager).InnerText;

   stringerrorSource=

   categoryNode.SelectSingleNode("errorNS:ErrorSource",

   nsManager).InnerText;

   MessageBox.Show("ErrorNumberis"+errorNumber);

   MessageBox.Show("ErrorMessageis"+errorMessage);

   MessageBox.Show("ErrorSourceis"+errorSource);

   }

下一页 下一页