Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
I am trying to get xml response.
It gives me response but not in proper format
It converts the xml tag into "<" and ">"

It give the response in following manner

XML
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="www.detroittradingexchange.com/">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;PINGGX_RESPONSE xmlns="www.detroittradingexchange.com/SellerMessages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="www.detroittradingexchange.com/SellerMessages
http://www.detroittradingexchange.com/SellerMessages/SellGx_response.xsd"&gt;
  &lt;DTX_LEAD_ID&gt;-1&lt;/DTX_LEAD_ID&gt;
  &lt;SUCCESS&gt;False&lt;/SUCCESS&gt;
  &lt;CACHED_RESPONSE&gt;False&lt;/CACHED_RESPONSE&gt;
  &lt;PRICE&gt;0.0&lt;/PRICE&gt;
  &lt;REASON&gt;UNKNOWN_GEN&lt;/REASON&gt;
  &lt;REASON_MESSAGE&gt;Invalid Login&lt;/REASON_MESSAGE&gt;
  &lt;ERROR&gt;&lt;/ERROR&gt;
  &lt;ERROR_MESSAGE&gt;&lt;/ERROR_MESSAGE&gt;
&lt;/PINGGX_RESPONSE&gt;</string>


I want to convert into proper xml format like


Please help me
Posted

The following article may help you:
Escape and unescape text[^]
 
Share this answer
 
You can use the escape text &lt; and &gt;
 
Share this answer
 
use string.Replace to replace the < and > to convert to "<" and ">" respectively
 
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