Hi,
I've written an app that dumps COM+ configuration information to an XML file.
Here's a portion of the XML file.
<applications>
<application>
<name>XkJlCrdGeneral</name
>
<description />
<activation>Server</activa
tion>
<identity>domain\user</ide
ntity>
<id>{111A6409-AEB4-4340-93
77-76D85EB
B9C51}</id
>
<applicationaccesschecks>F
alse</appl
icationacc
esschecks>
<components>
<component>
<file>E:\folder\XkJlCrdGen
eral\CRDBu
sinessObje
ct.dll</fi
le>
<description>CRDBusinessOb
ject.IBusi
nessObject
</descript
ion>
</component>
<component>
<file>E:\folder\XkJlCrdGen
eral\CRDTr
adeTracker
.dll</file
>
<description>CRDTradeTrack
er.TradeTr
acker</des
cription>
</component>
</components>
</application>
<application>
<name>Cail</name>
<description />
<activation>Server</activa
tion>
<identity>NT AUTHORITY\LOCALSERVICE</id
entity>
<id>{F49C7C0E-E8DF-4CC8-8D
A6-E973799
2A5AA}</id
>
<applicationaccesschecks>F
alse</appl
icationacc
esschecks>
<components>
<component>
<file>E:\folder\Cail\CAILR
egistry.dl
l</file>
<description>CAILRegistry.
Registry</
descriptio
n>
</component>
<component>
<file>E:\folder\Cail\Stand
ardRegistr
y.dll</fil
e>
<description>StandardRegis
try.Regist
ry</descri
ption>
</component>
</components>
</application>
My plan is to use this XML file to re-create the COM+ components on another server (to create a duplicate of that server).
I have this code to get all the <application> elements.
XmlNodeList nodes = xmlDoc.GetElementsByTagNam
e("applica
tion");
I now want to get the data from each of the application elements and use them to set the properties of a comApplication class that i've built, so I want to do something like (this is obviously made-up):
foreach(XmlNode node in nodes)
{
comApplication app = new comApplication();
XmlNodeList elements = node.ChildNodes;
app.Name = elements.GetChildNodeByNam
e("name");
//This is the bit I need to do
}
I know I can use node.ChildNodes[I] to get the elements by index, but i'd rather use Names to ensure that i'm populating my class's properties with the correct elements.
So can anyone tell me if it's possible to retrieve the child elements of a node by name?
Thanks
Mick
Start Free Trial