In my ASP.NET MVC 5 website i have the following scenario:
When user clicks on a button, it calls an JsonResult that returns a string representing a XML. but when i try to displey it on a div, i get just the node values of this string.
<div id="xmlContent"/>
<script language="javascript">
function CustomButtonClick(s, e) {
var gridKey = s.GetRowKey(e.visibleIndex);
if (e.buttonID === 'btnShowXmlContent') {
$.getJSON('@Url.Action("GetXmlContent")', { gridKey: gridKey }, function (data) {
alert(data);
$('#xmlContent').html(data);
pcXmlContent.Show();
});
};
}
</script>
The plain XML:
<?xml version="1.0" encoding="utf-16"?>
<HEADER>
<NumeroOperacao>201406030927460355</NumeroOperacao>
</HEADER>
<MESSAGE>
<ERROR>Object reference not set to an instance of an object.</ERROR>
</MESSAGE>
The HTML version of this xml:
201406030927460355
Object reference not set to an instance of an object.
I would like to know how can i display this xml as plain xml? Thanks