c# - How To Create XPath for XML? -


i have 1 xml file in want make filter based on xpath. tried lot of examples none of them helping no doubt doing mistake. new in xpath please me find solution.

<peoplebatch counter="3"> <citriz id="1d9a88fe-f9cc-4add-b6d1-01e41c561bfb" mversion="1.0.0" msequence="1" pversion="0.0.1" xmlns="http://citriz/schemas">     <people action="u" status="cd" peopleid="1" peopleshortname="billy" peoplelongname="billy smith" peopletypecode="commercial" countrycode="usa" peoplestatus="current">             <peoplerole action="u" status="cd" id="1" customerroleshortname="billy" customerrolelongname="billy smith" typecode="outs">                     <sendrole roletype="n" activerole="y"/>             </peoplerole>     </people> </citriz> <citriz id="1d9a88fe-f9cc-4add-b6d1-01e41c561bfc" mversion="1.0.0" msequence="2" pversion="0.0.1" xmlns="http://citriz/schemas">     <people action="u" status="cd" peopleid="2" peopleshortname="carl" peoplelongname="carl thomas" peopletypecode="commercial" countrycode="usa" peoplestatus="current">             <peoplerole action="u" status="cd" id="2" customerroleshortname="carl" customerrolelongname="carl thomas" typecode="inss">                     <sendrole roletype="n" activerole="y"/>             </peoplerole>     </people> </citriz>    <citriz id="1d9a88fe-f9cc-4add-b6d1-01e41c561bfd" mversion="1.0.0" msequence="3" pversion="0.0.1" xmlns="http://citriz/schemas">     <people action="u" status="cd" peopleid="3" peopleshortname="ryan" peoplelongname="ryan black" peopletypecode="commercial" countrycode="usa" peoplestatus="current">             <peoplerole action="u" status="cd" id="3" customerroleshortname="ryan" customerrolelongname="ryan black" typecode="inss">                     <sendrole roletype="n" activerole="y"/>             </peoplerole>     </people> </citriz>    

i need "citriz" node child node attribute contains typecode="inss" value. or suggest me if there other way.

i think have problem xml namespaces

xnamespace ns = "http://citriz/schemas"; var peoplerole = xdocument.parse(xml)                     .descendants(ns + "peoplerole")                     .where(p => p.attribute("typecode").value == "inss")                     .tolist(); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -