Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8029373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:25:12+00:00 2026-06-05T00:25:12+00:00

Can someone help me out in the best way to display a raw xml

  • 0

Can someone help me out in the best way to display a raw xml string to a browser in an xml formatted way?

The code i created below does not display anything to the it and gives in error:

  string xml = GetMessageXml(Request.QueryString["ID"].ToString());
            XDocument doc;
            using (StringReader s = new StringReader(xml.Substring(1)))
            {
                doc = XDocument.Load(s);
            }
            Response.ContentType = "text/xml";
            doc.Save(Response.Output);
            Response.Write(doc.ToString());

Error:

XML Parsing Error: junk after document element
‘Location:H t t p: localhost/Accounts/EventLogMessageDetails.aspx?id=178’
Line Number 83, Column 9:’

this is the xml string:

?<?xml version="1.0" encoding="utf-8"?>
<Order xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<OrderID>00000000-0000-0000-0000-000000000000</OrderID>
<IsOrderThrough>true</IsOrderThrough>
<VendorName>le</VendorName>
<OrderUniqueIdentifier>K03936</OrderUniqueIdentifier>
<SoldToCustomerID>A786</SoldToCustomerID>
<ShipToCustomerID>A786</ShipToCustomerID>
<OrderType>Standard</OrderType>
<CustomerPurchaseOrderNumber>PO0000336</CustomerPurchaseOrderNumber>
<ProjectName />
<EmailAddress>Nair@ecomkva.com</EmailAddress>
<DeliveryDate>2012-05-29T10:09:55.492696-05:00</DeliveryDate>
<ShipToAddress>
<AddressID>00075</AddressID>
<OrganizationName>SEBA-E</OrganizationName>
<AddressLine1>3700 STATE</AddressLine1>
<AddressLine2>Elk</AddressLine2>
<City>LA CROSSE</City>
<State>WI</State>
<ZipCode>54601</ZipCode>
<Country>US</Country>
<DaytimePhoneNumber>6782260680EXT</DaytimePhoneNumber>
</ShipToAddress>
<ShippingMethodName>FEDEX PRIORITY OVERNIGHT</ShippingMethodName>
<ShippingMethodID>F01</ShippingMethodID>
<MarketSegment>Commercial</MarketSegment>
<Comments>Elk^</Comments>
<LineItems>
<OrderLineItem>
<LineItemID>00000000-0000-0000-0000-000000000000</LineItemID>
<ProductID>Kbv</ProductID>
<Quantity>2</Quantity>
<ListPrice>10.67</ListPrice>
<PlacedPrice>3.84</PlacedPrice>
<DeliveryDate>2012-05-29T10:09:56.6957979-05:00</DeliveryDate>
<ShippingAddress>
<AddressID>Z00138075</AddressID>
<OrganizationName>moomoo</OrganizationName>
<AddressLine1>3700 STATE ROAD 16</AddressLine1>
<AddressLine2>moomoo</AddressLine2>
<City>LA CROSSE</City>
<State>WI</State>
<ZipCode>54601</ZipCode>
<Country>US</Country>
<DaytimePhoneNumber>675555550680EXT</DaytimePhoneNumber>
</ShippingAddress>
<ShippingMethodID>F01</ShippingMethodID>
<EmailAddress>IS@Cnj.com</EmailAddress>
<Comments />
<SequenceNumber>0</SequenceNumber>
</OrderLineItem>
</LineItems>
<BusinessUnit />
<FOBPoint>FB2</FOBPoint>
<Notify>TD</Notify>
<WorkOrder />
<SubmittedByUserName>TDAVIS</SubmittedByUserName>
<SpecialInstructions />
</Order>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:25:14+00:00Added an answer on June 5, 2026 at 12:25 am

    This is what I have did quickly.

    Added Order.xml into my ASP.NET Project.

    Create an Showorder.aspx page as and included C# code between <% and %> as below:

    <body>
     <form id="form1" runat="server">
      <div>
       <% 
         string xml = Request.QueryString["ID"].ToString();
            XDocument doc;
            doc = XDocument.Load(xml);
            Response.Write("<XMP>"+ doc.ToString()+"<\\XMP>");
            %>
        </div>
      </form>
    </body>
    

    After that I launched my page as below:

      http://localhost:52134/showxml.aspx?ID=http://localhost:52134/order.xml
    

    I do get the XML as below: (Note: Be sure to use XMP …./XMP otherwise you will not see formatted XML in browser)

    enter image description here

    Feel free to experiment the code and try any way you would want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone help me figuring out why the following jQuery code doesn't work? I
Can someone please help me figure out a way to achieve the following (see
Can someone help me out with this one. I have a page, in which
can someone please help me out? I'm trying to create an input dynamically with
Can someone please help me out with a JavaScript/jQuery solution for this arithmetic problem:
Quick question hopefully someone can help out here. I'm trying to copy and paste
Perhaps someone can help me out with this one: I'm using a basic search
Hope someone can help me out with this problem I am having. I just
I am hoping someone can help me out with a quick question I have
I wonder if someone can help me out with regards to the memory management

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.