parsing SOAP response in C#...not understanding the XML namespaces -


please excuse me, i'm new soap , c#. can't seem figure out how correctly set namespaces find node in soap response.

here's response if web service query returns empty:

<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">     <soapenv:body>         <ns:vxwsresponse xmlns:ns="vx.sx">             <ns:list ns:id="result" />         </ns:vxwsresponse>     </soapenv:body> </soapenv:envelope> 

here's response if returns data:

<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">     <soapenv:body>         <ns:vxwsresponse xmlns:ns="vx.sx">             <ns:list ns:id="result">                 <ns:badge>user data</ns:badge>             </ns:list>         </ns:vxwsresponse>     </soapenv:body> </soapenv:envelope> 

i need know if tag present.

here's have far.

xmlnamespacemanager manager = new xmlnamespacemanager(xml.nametable); manager.addnamespace("ns", "vx.sx"); manager.addnamespace("id", "result"); xmlnode badge = xml.selectsinglenode("//id:badge", manager); xmlnode result = xml.selectsinglenode("//ns:result", manager); 

both nodes return null. i've looked @ number of other articles on site, i'm not seeing how correctly address namespaces in response xml.

any appreciated!

the id attribute of list node, not namespace.

i edited answer check badge element seem want for.

        xmlnamespacemanager manager = new xmlnamespacemanager(xmldoc.nametable);         manager.addnamespace("ns", "vx.sx");          xmlnode badge = xmldoc.selectsinglenode("//ns:badge", manager);          if (badge == null)         {           // no badge element         }         else         {             // badge element present         } 

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 -