Home Create XML file using c# like below format
Reply: 0

Create XML file using c# like below format

user2069 Published in August 15, 2018, 9:02 am

I need to create xml using c# below format.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <AddressLine1 xmlns="">50 W TOWN ST</AddressLine1>
        <AddressLine2 xmlns="">STE 400</AddressLine2>
        <City xmlns="">COLUMBUS</City>
        <State xmlns="">OH</State>
        <Zip xmlns="">43215</Zip>
        <Zip4 xmlns=""/>

Below is my c# code to create xml like above

        XmlDocument doc = new XmlDocument();
        XmlNode docNode = doc.CreateElement("SOAP-ENV:Envelope");
        XmlAttribute typeAttr = doc.CreateAttribute("xmlns:SOAP-ENV");
        typeAttr.Value = "http://schemas.xmlsoap.org/soap/envelope/";

        XmlNode AddressRequestBody = doc.CreateElement("SOAP-ENV:Body");


        XmlNode Zip4Node = doc.CreateElement("Zip4");
        typeAttr = doc.CreateAttribute("xmlns");
        typeAttr.Value = "";

With the above code I am geting xml like below. missing SOAP-ENV: in Envelop and body tags. Any idea to how to get SOAP-ENV: in both Envelop and body tags. I am new to xml not sure how to get.

<Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <AddressLine1 xmlns="">Add1</AddressLine1>
  <AddressLine2 xmlns="">Add2</AddressLine2>
  <City xmlns="">City1</City>
  <State xmlns="">state1</State>
  <Zip xmlns="">zip1</Zip>
  <Zip4 xmlns=""></Zip4>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306124 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO