Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
xml writing using xmldocument in c#
vipin saini
14y
6.9k
1
Reply
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
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Application Not Respoding while BackgroundWorker Thread Working...
MyInstaller