[wix-users] Find and Change XML Specific Element

Brian E brianke at gmail.com
Fri Nov 5 13:52:26 PDT 2021


Through some trial and error I found the culprit was the '@'.  Once I
removed that, the XmlFile worked correctly.


Brian

If you can't explain it simply, you don't understand it well enough.  -
Albert Einstein


On Fri, Nov 5, 2021 at 4:32 PM Brian E <brianke at gmail.com> wrote:

> Yes, the DelphiaConfig is a typo and unfortunately, this suggestion did
> not work.  Still get an error of "Failed to find node".
>
> Brian
>
> If you can't explain it simply, you don't understand it well enough.  -
> Albert Einstein
>
>
> On Fri, Nov 5, 2021 at 3:55 PM Edwin Castro <egcastr at gmail.com> wrote:
>
>> I'm assuming the difference between MyConfig in the file content example
>> and DelphiaConfig in the xpath is just a typo.
>>
>> Try this xpath?
>>
>> ElementPath="//DelphiaConfig/ScheduledServices/RemoteApplica
>> nt[\[]@Name='ApplicantStackJob'[\]]/URL/text()"
>>
>> --
>> Edwin G. Castro
>>
>>
>> On Fri, Nov 5, 2021 at 12:06 PM Brian E via wix-users <
>> wix-users at lists.wixtoolset.org> wrote:
>>
>>> I have this XML:
>>>
>>> <MyConfig>
>>>   <ScheduledServices>
>>>     <RemoteApplicant>
>>>       <Name>ApplicantStackJob</Name>
>>>       <URL></URL>
>>>     </RemoteApplicant>
>>>   </ScheduledServices>
>>> </MyConfig>
>>>
>>> There are additional <RemoteApplicant> elements, each with a unique
>>> <Name>.  How can I use XmlFile to find this specific element
>>> (<RemoteApplicant> with <Name> = 'ApplicantStackJob') and set the
>>> <URL>.  I
>>> have have tried the following, which works if I omit the
>>> "[\[]@Name...[\]]"
>>> portion but sets all the URLs to the same value
>>>
>>>       <util:XmlFile Id="UpdateApplicantStackURL"
>>>                     Action="setValue"
>>>                     File="[CONFIGFOLDER]config.xml"
>>>                     SelectionLanguage="XPath"
>>>
>>>
>>> ElementPath="//DelphiaConfig/ScheduledServices/RemoteApplicant[\[]@Name='ApplicantStackJob'[\]]/URL"
>>>                     Value="[APPLICANTSTACK_API_URL]"
>>>                     Sequence="5" />
>>>
>>> However, it does not work when I add the "[\[]@Name...[\]]" portion to
>>> the
>>> path.
>>>
>>>
>>> Brian
>>>
>>> If you can't explain it simply, you don't understand it well enough.  -
>>> Albert Einstein
>>>
>>> ____________________________________________________________________
>>> WiX Toolset Users Mailing List provided by FireGiant
>>> http://www.firegiant.com/
>>>
>>



More information about the wix-users mailing list