Step 1: Create XML Sheet As shown in below:
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <FORMP2:Form
- xmlns:FORMP2="http://incometaxindiaefiling.gov.in/FORMP2"
- xmlns:F15CA="http://incometaxindiaefiling.gov.in/F15CA"
- xmlns:FORM15CA="http://incometaxindiaefiling.gov.in/Form15CA"
- xmlns:Form="http://incometaxindiaefiling.gov.in/common"
- xmlns:FormCommon="http://incometaxindiaefiling.gov.in/Form/Common"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://incometaxindiaefiling.gov.in/FORMP2 form.form15CA.xsd ">
- <FORM15:Form15>
- <Form:CreationInfo>
- <Form:SWVersionNo>string</Form:SWVersionNo>
- <Form:SWCreatedBy>string</Form:SWCreatedBy>
- <Form:XMLCreatedBy>string</Form:XMLCreatedBy>
- <Form:XMLCreationDate>2015-02-19</Form:XMLCreationDate>
- <Form:IntermediaryCity>string</Form:IntermediaryCity>
- </Form:CreationInfo>
- </FORM15:Form15>
- </FORMP2:Form>
Step 2: C# Code.
- string PATH = Server.MapPath("My.xml");
-
- if (!System.IO.File.Exists(PATH)) {} else
- {
- XDocument doc = XDocument.Load(PATH);
-
- foreach(XElement el in doc.Root.Elements()) {
- XNamespace ns15 = el.GetNamespaceOfPrefix("FORM15");
- XNamespace ns16 = el.GetNamespaceOfPrefix("F15CA");
- doc.Root.Elements(ns15 + "Form15CA").Descendants(ns16 + "CreationInfo");
- foreach(XElement ele in doc.Root.Elements(ns15 + "Form15").Descendants(ns16 + "CreationInfo")) {
- XNamespace nsE80 = el.GetNamespaceOfPrefix("Form");
-
-
-
-
- foreach(XElement element in ele.Elements())
- if (element.Name == (nsE80 + "SWVersionNo")) element.Value = "1";
- else if (element.Name == (nsE80 + "SWCreatedBy")) element.Value = "DIT-EFILING-JAVA";
- else if (element.Name == (nsE80 + "XMLCreatedBy")) element.Value = "DIT-EFILING-JAVA";
- else if (element.Name == (nsE80 + "XMLCreationDate")) element.Value = DateTime.Now.ToString("dd-MM-yyyy");
- else if (element.Name == (nsE80 + "IntermediaryCity")) element.Value = "Delhi";
- }
- }
- }