Page 1 of 1

XPath command

Posted: Tue Jul 21, 2020 6:03 pm
by mdavtec
Is it possible to get value of 'Password" which is 'P@ssword1' from this XML text using XPath command? I was able to get the entire string using following command:
Evaluate Query //configuration/connectionStrings/add[@name="UDS"] on XML file $PROGRAMDATAFOLDER$\Web\Web.config, get result into variable UDSAppPWD as type Full XML String

Wonder if there is a better way to get password value.

<clear />
<add name="UDS" connectionString="Server=localhost\DataED;Database=UDS;User Id=UDS_App;Password=P@ssword1" providerName="System.Data.SqlClient" />
<add name="UDSEntities" connectionString="metadata=res://*/SmsModel.csdl|res://*/SmsModel.ssdl|res://*/SmsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Server=localhost\DataED;Database=UDS;User Id=UDS_App;Password=P@ssword1;&quot;" providerName="System.Data.EntityClient" />
<add name="UDSAdmin" connectionString="Server=localhost\DataED;Database=UDS;User Id=UDS_Admin;Password=P@ssword1" providerName="System.Data.SqlClient" />
<!-- Used by ASP.NET Identity -->


Re: XPath command

Posted: Wed Jul 22, 2020 12:02 pm
by FrancescoT
You may use the following query in combination with "Result Type= Node Value":

This will restrict the returned value to:
"Server=localhost\DataED;Database=UDS;User Id=UDS_App;Password=P@ssword1"

But you can't get just the password, because there isn't any password value. Password is part of value assigned with "connectionString".