3

So i have gone through some example where XML is static and that can be displayed using pre , code and textarea tag.

my real problem is i am generating xml as string in jquery which looks like below

string str = "<?xml version='1.0' encoding='UTF-8'?><items><item><Name>c</Name><Value>a</value></item><item><Name>b</Name><Value>b</value></item><item><Name>a</Name><Value>c</value></item><item></items>"

now i want to display this string as proper xml indentation like below

<?xml version='1.0' encoding='UTF-8'?>
<items>
 <item>
  <Name>c</Name>
  <Value>a</value>
 </item>
 <item>
  <Name>b</Name>
  <Value>b</value>
 </item>
 <item>
  <Name>a</Name>
  <Value>c</value>
 </item>
</items>

what should be the best approach?

PalakM
  • 301
  • 2
  • 17

0 Answers0