vipin saini

vipin saini

  • NA
  • 88
  • 0

xml writing using xmldocument in c#

Sep 22 2010 3:27 AM

i am using this code
XmlDocument
xmlDoc = new XmlDocument();
 
// Write down the XML declaration
XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);
XmlElement Envelope = xmlDoc.CreateElement("SOAP-ENV", "Envelope", "http://schemas.xmlsoap.org/soap/envelope/");
// XmlAttribute soapenc = xmlDoc.CreateAttribute("soapenc", "xmlns", "http://schemas.xmlsoap.org/soap/encoding/");
XmlAttribute xlink = xmlDoc.CreateAttribute("xlink", "xmlns", "http://www.w3.org/1999/xlink");
XmlAttribute eb = xmlDoc.CreateAttribute("eb", "xmlns", "http://www.ebxml.org/namespaces/messageHeader");
XmlAttribute xsd = xmlDoc.CreateAttribute("xsd", "xmlns", "http://www.w3.org/1999/XMLSchema");
// XmlAttribute xsi = xmlDoc.CreateAttribute("xsi", "xmlns", http://www.w3.org/2001/XMLSchema-instance);
Envelope.SetAttributeNode(xsi);
Envelope.SetAttributeNode(xsd);
Envelope.SetAttributeNode(xlink);
xmlDoc.AppendChild(Envelope);
it gives out put as
<
SOAP-ENV:Envelope xlink:xmlns="" eb:xmlns="" xsd:xmlns="" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" />
but i want in the format
<
SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<
SOAP-ENV:Header/>
please help me

Answers (2)