Archive: Selecting a node according to attribute value from xml file


Selecting a node according to attribute value from xml file
  So here is my problem. I can't pick the right element in xml file, i'm trying to do it like this:

   ${xml::GotoPath} "/configuration/components/component***91;@id = "applicationSettings.default"***93;/parameters/dbServerName" $0

MessageBox MB_OK "xml::1GotoPath$\n$$0=$0"
from the file:
<?xml version="1.0" encoding="utf-8" ?>

><configuration>
<components>
..
..
<component id="applicationSettings.default" type="EMC.Controls.Settings.ApplicationSettings, EMC.Controls">
<parameters>
<dbServerName>localhost</dbServerName>
<dbName>EMC</dbName>
<dbServerPort>3050</dbServerPort>
<DbServerType>0</DbServerType>
<DocumentPath>C:\Mokymo serveris\Data\OOForms\</DocumentPath>
<openOfficePath>C:\Program Files\OpenOffice.org 2.2\program\</openOfficePath>
<ViewSettingsFile>EMC.exe.ViewSettings.xml</ViewSettingsFile>
<TemporarySettingsFile>EMC.exe.TemporarySettings.xml</TemporarySettingsFile>
</parameters>
</component>
</components>
</configuration>
And this works fine:

0

MessageBox MB_OK "xml::2GotoPath$\n$$0=$0"
I believe that i need to find other way to write simbol ' around 'applicationSettings.default'.

I'm using this: http://nsis.sourceforge.net/XML_plug-in

Any suggestions what's wrong there and how to do it right?

You have a quoting problem there. You use double quotes for quoting both the id and the entire line. Use a single quote for one of them.


Originally posted by kichik
You have a quoting problem there. You use double quotes for quoting both the id and the entire line. Use a single quote for one of them.
Well, I use single quote, I don't know why here is double, maybe because i braced it with "PHP". For sake of clearness here it is again:

${xml::GotoPath} "/configuration/components/component[@id = 'applicationSettings.default']/parameters/dbServerName" $0

MessageBox MB_OK "xml::1GotoPath$\n$$0=$0"

And i really need to fix it somehow, any help is appreciated.

${xml::RootElement} $0 $1
MessageBox MB_OK "xml::RootElement$\n$$0=$0$\n$$1=$1"

${xml::XPathNode} "/configuration/components/component[@id='applicationSettings.default']/parameters/dbServerName" $0
MessageBox MB_OK "xml::XPathNode$\n$$0=$0"

${xml::GetText} $0 $1
MessageBox MB_OK "xml::GetText$\n$$0=$0$\n$$1=$1"