In C #, find the code instance of the specified xml element through xpath

Source: Internet
Author: User
Code snippets, code sharing, PHP code sharing, Java code sharing, Ruby code sharing, Python code sharing, HTML code sharing, CSS code sharing, SQL code sharing, and JavaScript code sharing
The content of orders. xml is as follows:
 
   
      
   
    
Remarkable Office Supplies
     
      
      
         
    
     
Electronic Protractor
          
    
     
42.99
        
       
         
    
     
Invisible Ink
          
    
     
200.25
        
     
  
 // The code snippet is from www.sharejs.com/codes/csharp/7775 C # code using System; using System. xml; public class XPathSelectNodes {private static void Main () {// Load the document. xmlDocument doc = new XmlDocument (); doc. load ("orders. xml "); XmlNodeList nodes = doc. selectNodes ("/Order/Items/Item/Name"); foreach (XmlNode node in nodes) {Console. writeLine (node. innerText);} Console. readLine () ;}/// the code snippet is from: www.sharejs.com/codes/csharp/7775

The above is the detailed content of the code instance for finding the specified element of xml through xpath in C #. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.