我正在从 xxx URl 读取 xml,但由于缺少 Root 元素而出现错误。
我读取 xml 响应的代码如下:
XmlDocument doc = new XmlDocument();
doc.Load("URL from which i am reading xml");
XmlNodeList nodes = doc.GetElementsByTagName("Product");
XmlNode node = null;
foreach (XmlNode n in nodes)
{
}
xml响应如下:
<All_Products>
<Product>
<ProductCode>GFT</ProductCode>
<ProductName>Gift Certificate</ProductName>
<ProductDescriptionShort>Give the perfect gift. </ProductDescriptionShort>
<ProductDescription>Give the perfect gift.</ProductDescription>
<ProductNameShort>Gift Certificate</ProductNameShort>
<FreeShippingItem>Y</FreeShippingItem>
<ProductPrice>55.0000</ProductPrice>
<TaxableProduct>Y</TaxableProduct>
</Product>
</All_Products>
你能告诉我哪里出错了。