c# - Get a subsection from XML -


i have followign xml:

<validationobject> <role name='pm front end'>   <filesystem>     <directory path='c:\deleteme\hashingtest\main' validateentirefolder='true'>       <file path='c:\deleteme\hashingtest\main\1.txt' hashvalue='-1109720489'/>       <file path='c:\deleteme\hashingtest\main\2.txt' hashvalue='824588598'/>       <file path='c:\deleteme\hashingtest\main\3.txt' hashvalue='-1033034397'/>       <directory path='c:\deleteme\hashingtest\main\sub1'>         <file path='c:\deleteme\hashingtest\main\sub1\sub1-1.txt' hashvalue='-1443348279'/>         <file path='c:\deleteme\hashingtest\main\sub1\sub1-2.txt' hashvalue='-666832362'/>       </directory>     </directory>     <!--only 2 file selected validation purposes in following folder-->     <directory path='c:\deleteme\hashingtest\sibling'>       <file path='c:\deleteme\hashingtest\sibling\1.txt' hashvalue='-444971301'/>       <file path='c:\deleteme\hashingtest\sibling\2.txt' hashvalue='-431992169'/>     </directory>   </filesystem> </role> 

i need extract direcotry xml snippet(s) xml if validateentirefolder true. there need list of file xelements.

i tried using xmlnode.selec­tnodes, requires exact xpath element. problem in case, not know xpaths. directory node can anywhere in tree.

can please me this?

thanks

using linq2xml

var xdoc = xdocument.load(filename); var dirs = xdoc.xpathselectelements("//directory[@validateentirefolder='true']"); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -