• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Output XML in browser

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

1 Solution
Add the xml declaration as the first line:

<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
Tony McCreathTechnical SEO ConsultantCommented:
Set the content-type in the response header to "text/xml"
Response.ContentType = "text/xml"

Open in new window


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now