Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
HTML

i have a xml
XML
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">

   <S:Body>
      <ns2:getApplicantResponse xmlns:ns2="http://ws.mcint/">
         <return>
            <mcNo>1000001404</mcNo>
            <firstNameAr>???</firstNameAr>
            <firstNameEn>RAJ</firstNameEn>
            <middleNameAr>??????</middleNameAr>
            <middleNameEn>NARAYAN</middleNameEn>
            <lastNameAr>????</lastNameAr>
            <lastNameEn>KHATWE</lastNameEn>
            <sex>M</sex>
            <dateOfBirth>1969-05-17T00:00:00+03:00</dateOfBirth>
            <fatherNameAr>??????</fatherNameAr>
            <fatherNameEn>NARAYAN</fatherNameEn>
            <motherNameAr>NARAYAN</motherNameAr>
            <motherNameEn>??????</motherNameEn>
            <countryCode>524</countryCode>
            <episodes>
               <mcEpisodesPK>
                  <episodeNo>1</episodeNo>
                  <mcNo>1000001404</mcNo>
               </mcEpisodesPK>
               <visaType>04</visaType>
               <visaNo>032005025647</visaNo>
               <passportNo>2095420</passportNo>
               <maritalStatus>U</maritalStatus>
               <pregnancyIndicator>N</pregnancyIndicator>
               <xrayRequired>Y</xrayRequired>
               <occupationCode>540</occupationCode>
               <sponsorCode>OTH</sponsorCode>
               <applicantTests>
                  <groupCode>HIV</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>1</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>1</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>401001374</specimenNo>
                  <testCode>ANTI-HIV</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>1</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>1</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>HIV</groupCode>
                  <testCode>ANTI-HIV</testCode>
                  <specimenNo>401001374</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>XG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>1</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>2</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>0</specimenNo>
                  <testCode>CXR</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>1</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>2</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>XG1</groupCode>
                  <testCode>CXR</testCode>
                  <specimenNo>0</specimenNo>
               </applicantTests>
               <applicationDetails>
                  <mcApplicationDetailsPK>
                     <episodeNo>1</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <typeCode>WRK</typeCode>
                  </mcApplicationDetailsPK>
                  <mcApplicationDetailsPK>
                     <episodeNo>1</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <typeCode>WRK</typeCode>
                  </mcApplicationDetailsPK>
               </applicationDetails>
            </episodes>
            <episodes>
               <mcEpisodesPK>
                  <episodeNo>2</episodeNo>
                  <mcNo>1000001404</mcNo>
               </mcEpisodesPK>
               <visaType>04</visaType>
               <visaNo>26581802115</visaNo>
               <passportNo>2091187</passportNo>
               <maritalStatus>U</maritalStatus>
               <pregnancyIndicator>N</pregnancyIndicator>
               <xrayRequired>Y</xrayRequired>
               <occupationCode>574</occupationCode>
               <sponsorCode>OTH</sponsorCode>
               <applicantTests>
                  <groupCode>LG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>1</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>101327859</specimenNo>
                  <testCode>ANTI-HCV</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>1</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>LG1</groupCode>
                  <testCode>ANTI-HCV</testCode>
                  <specimenNo>101327859</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>LG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>2</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>101327859</specimenNo>
                  <testCode>ANTI-HIV</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>2</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>LG1</groupCode>
                  <testCode>ANTI-HIV</testCode>
                  <specimenNo>101327859</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>XG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>3</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>0</specimenNo>
                  <testCode>CXR</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>3</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>XG1</groupCode>
                  <testCode>CXR</testCode>
                  <specimenNo>0</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>LG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>4</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>101327859</specimenNo>
                  <testCode>HBSAG</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>4</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>LG1</groupCode>
                  <testCode>HBSAG</testCode>
                  <specimenNo>101327859</specimenNo>
               </applicantTests>
               <applicationDetails>
                  <mcApplicationDetailsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <typeCode>RFL</typeCode>
                  </mcApplicationDetailsPK>
                  <mcApplicationDetailsPK>
                     <episodeNo>2</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <typeCode>RFL</typeCode>
                  </mcApplicationDetailsPK>
               </applicationDetails>
            </episodes>
            <episodes>
               <mcEpisodesPK>
                  <episodeNo>3</episodeNo>
                  <mcNo>1000001404</mcNo>
               </mcEpisodesPK>
               <visaType>04</visaType>
               <visaNo>29114405896</visaNo>
               <passportNo>29114405896</passportNo>
               <maritalStatus>U</maritalStatus>
               <pregnancyIndicator>N</pregnancyIndicator>
               <xrayRequired>Y</xrayRequired>
               <occupationCode>757</occupationCode>
               <sponsorCode>OTH</sponsorCode>
               <applicantTests>
                  <groupCode>PRF</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>1</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>651045862</specimenNo>
                  <testCode>ANTI-HBCT</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>1</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>PRF</groupCode>
                  <testCode>ANTI-HBCT</testCode>
                  <specimenNo>651045862</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>PRF</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>2</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>651045862</specimenNo>
                  <testCode>ANTI-HBS</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>2</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>PRF</groupCode>
                  <testCode>ANTI-HBS</testCode>
                  <specimenNo>651045862</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>LG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>3</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>101860252</specimenNo>
                  <testCode>ANTI-HCV</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>3</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>LG1</groupCode>
                  <testCode>ANTI-HCV</testCode>
                  <specimenNo>101860252</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>LG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>4</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>101860252</specimenNo>
                  <testCode>ANTI-HIV</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>4</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>LG1</groupCode>
                  <testCode>ANTI-HIV</testCode>
                  <specimenNo>101860252</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>XG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>5</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>0</specimenNo>
                  <testCode>CXR</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>5</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>XG1</groupCode>
                  <testCode>CXR</testCode>
                  <specimenNo>0</specimenNo>
               </applicantTests>
               <applicantTests>
                  <groupCode>LG1</groupCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>6</testNo>
                  </mcApplicantTestsPK>
                  <specimenNo>101860252</specimenNo>
                  <testCode>HBSAG</testCode>
                  <mcApplicantTestsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <testNo>6</testNo>
                  </mcApplicantTestsPK>
                  <groupCode>LG1</groupCode>
                  <testCode>HBSAG</testCode>
                  <specimenNo>101860252</specimenNo>
               </applicantTests>
               <applicationDetails>
                  <mcApplicationDetailsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <typeCode>BBL</typeCode>
                  </mcApplicationDetailsPK>
                  <mcApplicationDetailsPK>
                     <episodeNo>3</episodeNo>
                     <mcNo>1000001404</mcNo>
                     <typeCode>BBL</typeCode>
                  </mcApplicationDetailsPK>
               </applicationDetails>
            </episodes>
            <contact>
               <contact>5919200</contact>
               <mcApplicantContactsPK>
                  <contactCode>WK</contactCode>
                  <mcNo>1000001404</mcNo>
               </mcApplicantContactsPK>
               <remarks>5919200</remarks>
               <mcApplicantContactsPK>
                  <contactCode>WK</contactCode>
                  <mcNo>1000001404</mcNo>
               </mcApplicantContactsPK>
               <contact>5919200</contact>
               <remarks>5919200</remarks>
            </contact>
         </return>
      </ns2:getApplicantResponse>
   </S:Body>
</S:Envelope>



i want read each tag from this xml(eg;mcno).how i read this xml?
Posted
Updated 3-Nov-13 23:51pm
v4
Comments
Thomas ktg 4-Nov-13 5:19am    
What is that xml(eg;mcno)? Could you please make it little clear?
Mahesh Alappuzha 4-Nov-13 5:28am    
in xml file mcno is a attribute of that xml
S. M. Ahasan Habib 4-Nov-13 5:30am    
Please provide structured xml with sample 1 or 2 data. suppose <root><elements><element>1<element>2. It will help audience to understand your xml data structure and answer your question more easily. No need to show huge data as a part of question. Remember that in xml data/schema structure is important for programming. data is not important for solve problem. It is client asset.
Pheonyx 4-Nov-13 5:44am    
Well what have you tried? What have you googled? and what is your actual objective?
There is a brilliant article on this site on displaying XML documents in WPF, I'd link you to it, but if you had done any googling you'd have found it.

Maybe you don't need to parse XML directly but need to use SOAP System.Runtime.Serialization.Formatters.Soap.SoapFormatter:
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.formatters.soap.soapformatter%28v=vs.110%29.aspx[^].

It all depends on your purpose. To parse XML from scratch, .NET FCL provides at least three different ways. Please see my short overview of them below:
  1. Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^].
  2. Use the class System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx[^].
  3. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^], http://msdn.microsoft.com/en-us/library/bb387063.aspx[^].


[EDIT]

And it has nothing to do with WPF. You need to embrace the idea of separation of concerns: http://en.wikipedia.org/wiki/Separation_of_concerns[^].

Good luck,
—SA
 
Share this answer
 
v2
various way you can achieve that. You can use recursive way to navigate all xml element using xlinq.

The following link will show the way recursive algorithm implement.

http://www.java2s.com/Tutorial/CSharp/0540__XML/LoopThroughXmlDocumentRecursively.htm[^]
 
Share this answer
 
using System.Xml.XmlDocument.SelectNodes (MSDN Library) you can get the list of all nodes "mcNo"

C#
XmlDocument xml = new XmlDocument();
xml.Load(fileName);
XmlNodeList nodes = xml.SelectNodes("//mcNo"); // double '/' to get nodes at any level (XPath syntax)
 
Share this answer
 
This can be done easily with Linq to XML. Have a look into

http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900