hi
i want to write an xml with out using IO operation.
i dont want to write the xml in text file and then read from it.
for this i have used memory stream, but when i read the data from memory stream i gives wrong xml. some tags are added itsself in xml
here is the code.
MemoryStream str = new MemoryStream()
XmlTextWriter txtwriter = new XmlTextWriter(s tr,System.Text. Encoding.UTF8);
txtwriter.Write StartDocument() ;
txtwriter.Write StartElement("A ssessmentOrderA cknowledgement" );
txtwriter.Write StartElement("R eceiptId");
txtwriter.Write AttributeString ("idOwner", "The ID of the partner");
txtwriter.Write StartElement("I dValue");
txtwriter.Write AttributeString ("name", "receiptID" );
txtwriter.Write String("[ASR unique identifier]");
txtwriter.Write EndElement();
txtwriter.Write EndElement();
txtwriter.Write StartElement("A ccessPoint");
txtwriter.Write ElementString(" InternetWebAddr ess", data[0]);
txtwriter.Write EndElement();
txtwriter.Write StartElement("A ssessmentStatus ");
txtwriter.Write ElementString(" Status", "[Acknowledged]");
txtwriter.Write ElementString(" Details", "[Details of the status]");
txtwriter.Write EndElement();
txtwriter.Write EndElement();
txtwriter.Flush ();
txtwriter.Close ();
//Reading the xml
string xmfragment = System.Text.Enc oding.UTF8.GetS tring(str.GetBu ffer());
i am geting one more tag ie <string> extra and <?xml version="1.0" encoding="UTF-8" ?> extra
is there problem in coding?
or how cani achive my objective?
i want to write an xml with out using IO operation.
i dont want to write the xml in text file and then read from it.
for this i have used memory stream, but when i read the data from memory stream i gives wrong xml. some tags are added itsself in xml
here is the code.
MemoryStream str = new MemoryStream()
XmlTextWriter txtwriter = new XmlTextWriter(s tr,System.Text. Encoding.UTF8);
txtwriter.Write StartDocument() ;
txtwriter.Write StartElement("A ssessmentOrderA cknowledgement" );
txtwriter.Write StartElement("R eceiptId");
txtwriter.Write AttributeString ("idOwner", "The ID of the partner");
txtwriter.Write StartElement("I dValue");
txtwriter.Write AttributeString ("name", "receiptID" );
txtwriter.Write String("[ASR unique identifier]");
txtwriter.Write EndElement();
txtwriter.Write EndElement();
txtwriter.Write StartElement("A ccessPoint");
txtwriter.Write ElementString(" InternetWebAddr ess", data[0]);
txtwriter.Write EndElement();
txtwriter.Write StartElement("A ssessmentStatus ");
txtwriter.Write ElementString(" Status", "[Acknowledged]");
txtwriter.Write ElementString(" Details", "[Details of the status]");
txtwriter.Write EndElement();
txtwriter.Write EndElement();
txtwriter.Flush ();
txtwriter.Close ();
//Reading the xml
string xmfragment = System.Text.Enc oding.UTF8.GetS tring(str.GetBu ffer());
i am geting one more tag ie <string> extra and <?xml version="1.0" encoding="UTF-8" ?> extra
is there problem in coding?
or how cani achive my objective?
Comment