BobRozman
Posts: 2
Joined: Thu Jan 10, 2013 5:04 pm

XML Search duplicate node names

Greetings,

I'm attempting to read from a windows app.config file. I read thru your XML Search documentation and walked thru the XML Search tutorial but cannot figure out how retrieve a value from a child XML node where the nodes have the same names.

In particular, I want to extract the text ("SecurityDb1") from the <value> node below this node: <setting name="ServerSecurityDatabaseList" serializeAs="String">. The problem being that there are duplicate nodes named "setting".

Here is the XML structure I am dealing with.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
<configSections>
</configSections>
<userSettings>
<Application.Properties.Settings>
<setting name="DatabaseName" serializeAs="String">
<value>DatabaseName</value>
</setting>
<setting name="ServerName" serializeAs="String">
<value>ServerName</value>
</setting>
<setting name="UserId" serializeAs="String">
<value>UserId</value>
</setting>
<setting name="UserName" serializeAs="String">
<value>UserName</value>
</setting>
<setting name="SecurityDatabaseName" serializeAs="String">
<value>SecurityDb1</value>
</setting>

<setting name="ServerSecurityDatabaseList" serializeAs="String">
<value>Server1:SecurityDb1,SecurityDb2,SecurityDb3</value>
</setting>
</Application.Properties.Settings>
</userSettings>
</configuration>

Thank you for your assistance.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: XML Search duplicate node names

Hello,

In order to achieve what you want you can take a look on our "How to conditionally retain user settings after update" thread which debates a similar issue.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”