June 17th, 2003, 02:33 PM
Help - Display XML in an HTML file
What I'm trying to do is to display xml information in an IFRAME in an HTML document.
When I do this:
<IFRAME SRC="test.xml" WIDTH="78%" HEIGHT="300"></IFRAME>
The xml information displays perfectly in the frame. Just like you opened a .xml file in a browser.
But when I do this:
<IFRAME SRC="xmliframe.asp?CDHIC_ID=<%=vCDIHC_ID%>&xmlview=XML_SENT" WIDTH="78%" HEIGHT="300"></IFRAME>
Where the .asp file looks in a database to retrieves the XML and does a response.write with the field.
What I get displayed in the IFRAME is just the data between the elements. Like you opened a .html file with XML in it.
Does anyone have any ideas?
Thanks in Advance,
June 17th, 2003, 02:52 PM
Sounds to me like a header problem. I'm not familiar with asp, but the engine is probably outputting a (default) content-type response of text/html, so the browser tries to read the document as such. You likely need to set it to text/xml or something like that...
This is assuming your asp script is actually outputting the xml properly in the first place.
June 17th, 2003, 03:19 PM
Ya, it is outputting proper XML.. and you are correct, the asp is just ouputting HTML, and "yes" it probably is just using the default content type.
Now... pardon, my ignorance, but my HTLM is weak.. and I never mess with the header.
Can anyone give me an example.
Also.. an actual example.
http://www3.telus.net/decawi/test.xml is the xml and in the format that I want to see, even if the document has an .html extension
But... with the .html extension.. it looks like this...
These two files are identical, but the browser processes them differently. I want to force the XML format in the HTML file.