output as XML

Discussion in 'ASP General' started by Peter Morris, Oct 12, 2004.

  1. Peter Morris

    Peter Morris Guest

    I have an ASP program. It outputs HTML with some
    XML data islands in it. When I run the program, the
    browser sees the HTML and doesn't work the way
    I want it to. however, if I view source on the output
    page, save the source as an XML file, then open the
    saved file, it works properly.

    How do I get the browser to treat the output from an
    ASP program as XML instead of HTML?
    Peter Morris, Oct 12, 2004
    #1
    1. Advertising

  2. You need to change the MIME type the browser sees. By default, it sees
    "text/html" and treats it as it would any HTML page. Add the following code
    to the very top of your ASP page

    <%
    Response.ContentType = "text/xml"
    %>

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "Peter Morris" <nospam.ple@se> wrote in message
    news:VgFad.6955$...
    >
    > I have an ASP program. It outputs HTML with some
    > XML data islands in it. When I run the program, the
    > browser sees the HTML and doesn't work the way
    > I want it to. however, if I view source on the output
    > page, save the source as an XML file, then open the
    > saved file, it works properly.
    >
    > How do I get the browser to treat the output from an
    > ASP program as XML instead of HTML?
    >
    >
    Manohar Kamath, Oct 12, 2004
    #2
    1. Advertising

  3. Peter Morris wrote:
    > I have an ASP program. It outputs HTML with some
    > XML data islands in it. When I run the program, the
    > browser sees the HTML and doesn't work the way
    > I want it to. however, if I view source on the output
    > page, save the source as an XML file, then open the
    > saved file, it works properly.
    >
    > How do I get the browser to treat the output from an
    > ASP program as XML instead of HTML?


    This is a client-side issue, so one of the scripting groups, or one of the
    groups with "dhtml" in their names would be more appropriate.

    A data island is identified by using an XML tag:

    HTML stuff, then:
    <XML id=myDataIsland>
    xml stuff
    </XML>

    For more information, go to msdn.microsoft.com/library and search for "data
    island"

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Oct 12, 2004
    #3
  4. Minor clarification:
    Bob Barrows [MVP] wrote:
    > A data island is identified by using an XML tag:
    >


    <HTML>
    HTML stuff, then:
    <XML id=myDataIsland>
    xml stuff
    </XML>
    </HTML>
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Oct 12, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Grant Harmeyer

    asp:Xml control and Xml output

    Grant Harmeyer, Feb 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,078
    Chris Jackson
    Feb 3, 2004
  2. SV
    Replies:
    1
    Views:
    609
    Mukul Gandhi
    Aug 16, 2005
  3. Lukas
    Replies:
    3
    Views:
    787
    spiff
    Nov 10, 2005
  4. Jim Andersen

    Sort xml and output xml

    Jim Andersen, Dec 5, 2006, in forum: XML
    Replies:
    10
    Views:
    1,236
    Jim Andersen
    Dec 8, 2006
  5. Erik Wasser
    Replies:
    5
    Views:
    437
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page