Hi
I'm having trouble determining what the XML path should be to access a specific part of an XML file.
Here is the XML....
<?xml version="1.0"?>
<configuration>
<appSettings file="">
<clear />
<add key="SettingOne" value="A" />
<add key="SettingTwo" value="B" />
<add key="SettingThree" value="C" />
<add key="SettingFour" value="D" />
<add key="SettingFive" value="E" />
</appSettings>
</configuration>
Here is the code I'm using to test the XML path...
What would the XML path be if I'm trying to extract the values "SettingThree" and "C"?
I have tried configuration/appSettings/add:3/key but this causes an error: "The specified XML path is not valid or was not found."
When I use the path configuration/appSettings/add:3 GetElementXML does return the complete line, e.g. <add key="SettingThree" value="C" /> but I need the individual values within that.
Thanks in advance
I'm having trouble determining what the XML path should be to access a specific part of an XML file.
Here is the XML....
<?xml version="1.0"?>
<configuration>
<appSettings file="">
<clear />
<add key="SettingOne" value="A" />
<add key="SettingTwo" value="B" />
<add key="SettingThree" value="C" />
<add key="SettingFour" value="D" />
<add key="SettingFive" value="E" />
</appSettings>
</configuration>
Here is the code I'm using to test the XML path...
Code:
local function XMLTest(strPath) local strSource = _TempLaunchFolder.."\\test.XML" local strElementXML local strValueXML Debug.Print("Loading XML: "..strSource.."\r\n") XML.Load(strSource) Debug.Print("Attempting to get path: "..strPath.."\r\n") strElementXML = XML.GetElementXML(strPath) error = Application.GetLastError(); if (error ~= 0) then strElementXML = _tblErrorMessages[error] end strValueXML = XML.GetValue(strPath) error = Application.GetLastError(); if (error ~= 0) then strValueXML = _tblErrorMessages[error] end Debug.Print("Element XML: "..strElementXML.."\r\n") Debug.Print("Value XML: "..strValueXML.."\r\n") -- end
I have tried configuration/appSettings/add:3/key but this causes an error: "The specified XML path is not valid or was not found."
When I use the path configuration/appSettings/add:3 GetElementXML does return the complete line, e.g. <add key="SettingThree" value="C" /> but I need the individual values within that.
Thanks in advance
Comment