誰かが生のxml文字列をxml形式の方法でブラウザに表示するための最良の方法で私を助けてくれますか?
以下で作成したコードは何も表示せず、エラーが発生します。
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());
エラー:
XML解析エラー:ドキュメント要素の後にジャンク
'場所:H ttp:localhost / Accounts / EventLogMessageDetails.aspx?id = 178'
行番号83、列9:'
これはxml文字列です:
?<?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>