Custom Configuration Section

  • Thread starter Thread starter partysingh
  • Start date Start date
P

partysingh

Hi Folks,

I want to create a custom configuration section for getting the
request and response xmls for my application:

I want the format for it as:

<RequestResponseCollection>
<RequestResponse name="A">
<Request path="fileA.xml" />
<Response path="fileB.xml" />
</RequestResponse>
<RequestResponse name="B">
<Request path="fileC.xml" />
<Response path="fileD.xml" />
</RequestResponse>
</RequestResponseCollection>

I able to travese till RequestResponse. Please let me know how to
create the inner element to it.

I am using Dot Net 3.5.

Thanks,
 
Hi Folks,

I want to create a custom configuration section for getting the
request and response xmls for my application:

I want the format for it as:

<RequestResponseCollection>
        <RequestResponse name="A">
                <Request path="fileA.xml" />
                <Response path="fileB.xml" />
        </RequestResponse>
        <RequestResponse name="B">
                <Request path="fileC.xml" />
                <Response path="fileD.xml" />
        </RequestResponse>
</RequestResponseCollection>

I able to travese till RequestResponse. Please let me know how to
create the inner element to it.

I am using Dot Net 3.5.

Thanks,

If it's an XmlDocument then

XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml...
XmlNode xn = xDoc.SelectSingleNode("//RequestResponseCollection/
RequestResponse[@name='A']");

XmlNode newSub = xDoc.CreateNode(XmlNodeType.Element, "Request",
null);
XmlAttribute xa = xDoc.CreateAttribute("path");
xa.Value = "fileA.xml";
newSub.Attributes.Append(xa);
xn.AppendChild(newSub);

and the same for <Response>
 
Back
Top