Last post Mar 07, 2013 09:18 PM by Pengzhen Song - MSFT
Mar 07, 2013 05:53 AM|CLothering|LINK
I am completely new at XML, and trying to find out how it all works. I am getting an error : "Root element is missing". This happens on the xmldoc.Load().
The XML in a .html page which does a post to my aspx page. XML :
<form action="http://localhost:50035/InternalApps/PageName.aspx" method="post" >
<textarea name="XML" cols="80" rows="20" class="body_darkBlue">
<?xml version="1.0" encoding="UTF-8"?>
<reason>Message is delivered to destination. stat:DELIVRD</reason>
When posting, it runs through code that updates and inserts data(there is xml in the code - which was done before me, and works), but then it goes to the load event which fires off the sub I am interested in, which uses the following code :
(this is just part of the coding, as it doesnt get past the xmldoc.load)
Dim xmldoc As XmlDocument = New XmlDocument
'Page.Request.InputStream.Position = 0
xmldoc.Load(Page.Request.InputStream) 'The error occurs here''''''''''''''''''''''''''''''''''''''''''''''''
' Specify the Element that you will be working in...
Dim refnrnode As XmlElement = xmldoc.DocumentElement
Dim refnrnodelist As XmlNodeList = refnrnode.GetElementsByTagName("Response") ' <-- "Response" Element
Please could someone help and explain why. I have googled a lot, but cant seem to find anything that really makes much sense.
Thank you in advance!
Mar 07, 2013 07:15 AM|CLothering|LINK
I am actually going to just mark this one as the answer, as its seems that there were "duplicate" functions using the XML data. The one which was giving me the problem was actually incomplete it seems.... Thus the reason for not picking up the XML data.
Thanks in anycase...
Mar 07, 2013 09:18 PM|Pengzhen Song - MSFT|LINK
We are happy that your issue has been resolved. And Thanks for sharing the solution.