Output XML in browser

Posted on 2009-02-24
Last Modified: 2013-11-26
How would I output the variable below so I can see it as XML format in a browser?

I know I'm probably declaring the variable incorrectly
Dim _wXML As String

        _wXML = "<requestEnvelope>"

        _wXML &= "<requestHeader>"

        _wXML &= "<controlData>"

        _wXML &= "<clientName>XMLBusinessPartnerChannel</clientName>"

        _wXML &= "<userID>xmlweeksonly</userID>"

        _wXML &= "<password>xmlweeksonly</password>"

        _wXML &= "</controlData>"

        _wXML &= "<processData>"

        _wXML &= "<operationName>quickSearch</operationName>"

        _wXML &= "</processData>"

        _wXML &= "</requestHeader>"

        _wXML &= "<SearchRequest>"

        _wXML &= "<startDate>" & Format(startDate.SelectedDate, "MM/dd/yyyy").ToString & "</startDate>"

        _wXML &= "<endDate>" & Format(endDate.SelectedDate, "MM/dd/yyyy").ToString & "</endDate>"

        _wXML &= "<lengthOfStay>" & Trim(lengthOfStay.Text).ToString & "</lengthOfStay>"

        _wXML &= "<minUnitSize>" & Trim(minUnitSize.SelectedValue).ToString & "</minUnitSize>"

        _wXML &= "<regionCode>" & Trim(regionCode.Text).ToString & "</regionCode>"

        _wXML &= "</SearchRequest>"

        _wXML &= "</requestEnvelope>"

Open in new window

Question by:lrbrister
    LVL 27

    Accepted Solution

    Add the xml declaration as the first line:

    <?xml version=\"1.0\" encoding=\"UTF-8\" ?>
    LVL 23

    Expert Comment

    Set the content-type in the response header to "text/xml"
    Response.ContentType = "text/xml"

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now