Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to find the tag with in Xml string using asp.net with c#. I am getting the exception as below:
'http' is an unexpected token. Expecting white space. Line 1, position 216

My Xml is as below:
<ns5:Envelope xmlns:ns5="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://www.temenos.com/T24/ofs/Response" xmlns:ns3="https://soa.nbf.ae/Enquiry/" xmlns:ns6="http://www.w3.org/2001/XMLSchema xmlns:ns4="http://www.temenos.com/T24/ofs/ResponseCommon" xmlns:ns1="http://www.temenos.com/T24/ofs/NBFDDSLOANLOOKUPType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <ns5:Body>
 
       <ns3:T24EnquiryResponse>
  
           <Status> SUCCESS </Status>
  
           <EnquiryOutput>
  
              <NBFDDSLOANLOOKUP xmlns: ns0 = "http://www.temenos.com/T24/ofs/Response">
    
                   <gNBFDDSLOANLOOKUPDetailType>
    
                      <mNBFDDSLOANLOOKUPDetailType>
    
                         <ID> LD1930900010 </ID>
    
                         <CUSTOMERID> 575557 </CUSTOMERID>
    
                         <PRINLIQACCT> 012001447996 </PRINLIQACCT>
    
                         <DRAWDOWNACCOUNT> 012001447996 </DRAWDOWNACCOUNT>
    
                         <CURRENCY> AED </CURRENCY>
    
                         <AMOUNT> 14855.35 </AMOUNT>
    
                      </mNBFDDSLOANLOOKUPDetailType>
    
                   </gNBFDDSLOANLOOKUPDetailType>
    
                </NBFDDSLOANLOOKUP>
    
             </EnquiryOutput>
    
          </ns3:T24EnquiryResponse>
     
        </ns5:Body>


What I have tried:

Code is as below:
XmlDocument doc = new XmlDocument();
               XDocument xdoc = new XDocument();
               doc.LoadXml(ResponseAPI);


               XmlNodeList nodeList = doc.GetElementsByTagName("gNBFDDSLOANLOOKUPDetailType");

               foreach (XmlNode node in nodeList)
               {
                   isTest = true;

               }
Posted
Updated 8-Mar-20 20:58pm
v2

1 solution

Quote:
How to find the tag with in XML string using ASP.NET with C#?

Have a correction in your XML.
Replace
XML
<ns5:Envelope xmlns:ns5="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://www.temenos.com/T24/ofs/Response" xmlns:ns3="https://soa.nbf.ae/Enquiry/" xmlns:ns6="http://www.w3.org/2001/XMLSchema xmlns:ns4="http://www.temenos.com/T24/ofs/ResponseCommon" xmlns:ns1="http://www.temenos.com/T24/ofs/NBFDDSLOANLOOKUPType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

with
XML
<ns5:Envelope xmlns:ns5="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://www.temenos.com/T24/ofs/Response" xmlns:ns3="https://soa.nbf.ae/Enquiry/" xmlns:ns6="http://www.w3.org/2001/XMLSchema" xmlns:ns4="http://www.temenos.com/T24/ofs/ResponseCommon" xmlns:ns1="http://www.temenos.com/T24/ofs/NBFDDSLOANLOOKUPType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

2 quotes are missing
I recommend a professional programmer's editor, a feature is to highlight your code.
Notepad++ Home[^]
ultraedit[^]
 
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