Custom Configuration Section

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,
 
G

Guest

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top