disply raw xml, tags and all
OK, so I need to open up an XML file and copy the contents into a string and display as is, with the tags. What do you think can we do it? Crazy? Perhaps, but I just do what they ask. I thought I could trick the interpreter by putting quotation marks around the data, but I get "[object Object]" when I do that instead of [object Object]. Not that tricky I guess. I guess I will have to stick everything inside some <pre> tags eventually too.
- $('#display-xml').click(function(){
$.ajax({
url:'result.xml',
cache: false,
error: function(xhr, status, error){
alert("Error: " + xhr.status + " - " + error)},
dataType: 'xml',
success: function(data){
var html ='';
html = '<h3>Raw Plan XML</h3>';
html += '"';
html +=$(data).find('data');
html+= '"';
$('#graphicsDisplay').html(html)
}
}); //end get
}); // end click display-xml
Sample xml:
- <data>
<row>
<nai>23</nai>
<source>it</source>
<size>big</size>
<activity>rolling</activity>
<location>here</location>
<unit>cm</unit>
<time>now</time>
<equipment>red truck</equipment>
<remarks>none</remarks>
</row>
- </data>