#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    2
    Rep Power
    0

    Help - Display XML in an HTML file


    Hello,

    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,
    Dean
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2002
    Location
    Seattle WA
    Posts
    863
    Rep Power
    14
    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.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    2
    Rep Power
    0
    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...
    http://www3.telus.net/decawi/test.html

    These two files are identical, but the browser processes them differently. I want to force the XML format in the HTML file.

    Thanks
    Dean

IMN logo majestic logo threadwatch logo seochat tools logo