tags:

views:

371

answers:

3

This is the XML i am creating in javacript

I am sending this to an aspx page and doing the following things

XmlDocument objXmlDoc = new XmlDocument(); Request.InputStream.Position = 0; objXmlDoc.Load(Request.InputStream); objXmlDoc.Save("MyXML.xml");

It is showing an exception "root elemenet missing"

Is my XML not well formed ? I have a valid root element. Na ?

A: 

Sorry forgot to add the sending XML in previous post

<root> <GradeValueSet> <GradeValueSetMaster SetId="0" SetName="wrwr" SetComments="werwrwr" mode="add"/> <DetailInfo> <ChildInfo Name="This sfsf" Weightage="24"/> <ChildInfo Name="45654" Weightage="67"/> </DetailInfo> </GradeValueSet> </root>

+1  A: 

you might want to try saving the data as plain text from the aspx page to ensure the ONLY the xml is coming through.

Depending on how you are sending the data to the page, there could be extra information which is not part of the xml. Saving the data as plain text just to test this will show exactly what data you are getting.

Also, in the XML you do not actually need an element called "root", it's just referring to the top level element in your structure.

Jarod Elliott
A: 

How to save this as plaintext ?

just use any standard built in C# file stream or text writer. If you're not familiar with these i would strongly suggest doing some C# tutorials before going further with this.
Jarod Elliott