C # Searches for InfoPath-generated XML data based on criteria

Source: Internet
Author: User
xml| Data | conditions

InfoPath-generated XML files are as follows

<Table1>
<a></a>
<b></b>
<c>
<c1>1</c1>
<c2> Book </c2>
<c3> Good </c3>
</c>
<c>
<c1>2</c1>
<c2> Book </c2>
<c3></c3>
</c>
<c>
<c1>3</c1>
<c2> Book </c2>
<c3> Good </c3>
</c>
<c>
<c1>4</c1>
<c2>4</c2>
<c3>4</c3>
</c>
</Table1>

I want to get all the C2 = ' book ' of the value of the C1, online search for a while no similar example, had to be based on the InfoPath template in the XSL XPath to ponder

The following are feasible methods:

IXMLDOMNodeList nodelist = ThisXDocument.DOM.SelectNodes ("//table1/b/c/c1[. /C2 = ' book '] ");
Or
IXMLDOMNodeList nodelist = ThisXDocument.DOM.SelectNodes ("//table1/b/c/c1[. /C2 = \ "book \"]);

If you want to get C2 = ' book ' and C3 = ' good ' C1 value:

IXMLDOMNodeList nodelist = ThisXDocument.DOM.SelectNodes ("//table1/b/c/c1[. /C2 = ' book ' and. /C3 = ' good '] ");
Or
IXMLDOMNodeList nodelist = ThisXDocument.DOM.SelectNodes ("//table1/b/c/c1[. /C2 = \ "book \" and. /C3 = ' good



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.