Hi all,
i am a newbie in C#, and now i need you help...
i need to create an xmlfile with the following content at the beginning.
how can i do that?
i started with
SQL
XmlTextWriter textWriter = new XmlTextWriter(xmlfile, null);
XmlDocument doc = new XmlDocument();
XmlNode docNode = doc.CreateXmlDeclaration("1.0", "", null);
XmlNode customstate = doc.CreateElement("customStates");
XmlAttribute customstateAttribute = doc.CreateAttribute("xmlns");
customstateAttribute.Value = "http://schemas.microsoft.com/09/2005/communicator/customStates";
customstate.Attributes.Append(customstateAttribute);
customstateAttribute = doc.CreateAttribute("xmlns:xsi");
customstateAttribute.Value = "http://www.w3.org/2001/XMLSchema-instance";
customstate.Attributes.Append(customstateAttribute);
customstateAttribute = doc.CreateAttribute("xsi:schemaLocation");
customstateAttribute.Value =
"http://schemas.microsoft.com/09/2005/communicator/customStates
http://livecommteam/sites/main/ice/Wave%2012%20Docs/CustomActivities.xsd";
customstate.Attributes.Append(customstateAttribute);
doc.AppendChild(docNode);
doc.AppendChild(customstate);
doc.Save(textWriter);
|
but it doesnt work correctly. the Attribute "xsi:Schemalocation" is not written correctly to the xml files.
How can i do this?
Thanks
Pascal
naura paxRank #2,843 · 502 reputationPosted Jul 17, 2009, 2:22 AM EDT
http://stackoverflow.com/questions/1042994/creating-xml-file-header