anup_daware
Member
Hi Group,
I am facing a strange problem here:
I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception: “Unexpected end of file while parsing Name has occurred” is being thrown.
Following is the part o xml I am trying to read:
When I am trying to read the <BRAND>FIRESTONE</BRAND> (In Third item in the list), I am getting the “Unexpected end of file while parsing Name has occurred” exception. I am able to read the values from <BRAND> element for first two elements.
Following is the code I am using for reading the xml.
I also have searched net for this problem but I found nothing useful
Please let me know if I am doing something wrong or missing on something.
Thanks,
Anup Daware
I am facing a strange problem here:
I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception: “Unexpected end of file while parsing Name has occurred” is being thrown.
Following is the part o xml I am trying to read:
Code:
<CHECK_ITEM_OUT>
<ITEM id="">
<!-- id = [material] -->
<ITM_NUMBER>1</ITM_NUMBER>
<MATERIAL>001</MATERIAL>
<DEALER_CODE>DEL_One</DEALER_CODE>
<BRAND>Bridgestone</BRAND>
<HIERARCHY>HAR001</HIERARCHY>
<NET_PRICE>123.12</NET_PRICE>
<CURRENCY>EURO</CURRENCY>
</ITEM>
<ITEM id="">
<!-- id = [material] -->
<ITM_NUMBER>2</ITM_NUMBER>
<MATERIAL>002</MATERIAL>
<DEALER_CODE>DEL_Two</DEALER_CODE>
<BRAND>Firestone</BRAND>
<HIERARCHY>HAR002</HIERARCHY>
<NET_PRICE>453.12</NET_PRICE>
<CURRENCY>EURO</CURRENCY>
</ITEM>
<ITEM id="">
<!-- id = [material] -->
<ITM_NUMBER>3</ITM_NUMBER>
<MATERIAL>003</MATERIAL>
<DEALER_CODE />
<BRAND>FIRESTONE</BRAND>
<HIERARCHY>HAR001</HIERARCHY>
<NET_PRICE>24.12</NET_PRICE>
<CURRENCY>EURO</CURRENCY>
</ITEM>
</CHECK_ITEM_OUT>
When I am trying to read the <BRAND>FIRESTONE</BRAND> (In Third item in the list), I am getting the “Unexpected end of file while parsing Name has occurred” exception. I am able to read the values from <BRAND> element for first two elements.
Following is the code I am using for reading the xml.
C#:
case "BRAND":
if (!xmlTextReader.IsEmptyElement)
productInfo.Brand = xmlTextReader.ReadElementContentAsString(); break;
Please let me know if I am doing something wrong or missing on something.
Thanks,
Anup Daware
Last edited by a moderator: