cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read XML tag value when it contains namespace like ns0:

Newbie

How do I read XML tag value when it contains namespace like ns0:

I have a soap response from a PostXML call.

Need help in reading the value of a tag: Ticket_number

I am not able to read the value TKT0001, more so because of the namespace

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <soapenv:Body>

  <ns0:Test_soap_service xmlns:ns0="urn:Create_Ticket" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <ns0:Ticket_Number>TKT0001</ns0:Ticket_Number>

  </ns0:Test_soap_service>

  </soapenv:Body>

  </soapenv:Envelope>

Tags (1)
3 REPLIES 3
Highlighted

Re: How do I read XML tag value when it contains namespace like ns0:

Hello, Ranjan.

Are you getting an error thrown when you try to read TKT0001, or getting an empty value? If there is an error, what is that?

Thanks,

-- Craig A.

Re: How do I read XML tag value when it contains namespace like ns0:

try the below ! where 'response' is the soap response you got from the web service

var result= response.*::Body.*::Test_soap_service.*::Ticket_Number

Re: How do I read XML tag value when it contains namespace like ns0:

Thanks Raghu

It worked..