I am trying to set the value for element if the element value matches "ABB Automation Builder Platform.abpkg"
My script uses xmlpoke as below:
<XmlPoke
Namespaces="<Namespace Prefix='x' Uri='http://www150.abb.com/spaces/DAE-1/ProdDev/Shared%20Documents/40%20DAE%20Installer/Design/XML%20Descriptions/DAEInstaller_Description_StyleSheet' >"
Query="x:ProductUpdate/x:Packages/x:Package[x:FileName='ABB Automation Builder Platform.abpkg']/x:FileHash"
XmlInputPath="Output\update.manifest"
Value="Ajay Vishwakarma"/>
The xml I am trying to modify is below:
<?xml version="1.0" encoding="utf-8"?>
<ProductUpdate xmlns="http://www150.abb.com/spaces/DAE-1/ProdDev/Shared%20Documents/40%20DAE%20Installer/Design/XML%20Descriptions/DAEInstaller_Description_StyleSheet">
<Strings>
<Text id="1">
<Neutral>ABB Automation Builder 1.0 \nService Release 1</Neutral>
<Localized culture="en">ABB Automation Builder 1.0 \nService Release 1</Localized>
<Localized culture="de">ABB Automation Builder 1.0 \nService Release 1</Localized>
<Localized culture="fr">ABB Automation Builder 1.0 \nService Release 1</Localized>
<Localized culture="es">ABB Automation Builder 1.0 \nService Release 1</Localized>
<Localized culture="zh">ABB Automation Builder 1.0 \nService Release 1</Localized>
</Text>
<Text id="2">
<Neutral>Information\ABB Automation Builder Upate Package V1_0_1Description_en.htm</Neutral>
<Localized culture="en">Information\ABB Automation Builder Upate Package V1_0_1Description_en.htm</Localized>
<Localized culture="de">Information\ABB Automation Builder Upate Package V1_0_1Description_de.htm</Localized>
<Localized culture="fr">Information\ABB Automation Builder Upate Package V1_0_1Description_fr.htm</Localized>
<Localized culture="es">Information\ABB Automation Builder Upate Package V1_0_1Description_es.htm</Localized>
<Localized culture="zh">Information\ABB Automation Builder Upate Package V1_0_1Description_zh.htm</Localized>
</Text>
</Strings>
<ReleaseType>ServicePack</ReleaseType>
<ProductName>$1</ProductName>
<Version>1.0.1</Version>
<Description>$2</Description>
<License>
<Name>$3</Name>
<ID>45668677876463</ID>
<Description>$4</Description>
<Version>1.0.1</Version>
<DescriptionVersion>$5</DescriptionVersion>
<DescriptionTypeVersion>1.0.0</DescriptionTypeVersion>
<ToAccept>true</ToAccept>
</License>
<Copyright>$6</Copyright>
<MinimumRequiredVersion>1.0.0</MinimumRequiredVersion>
<Packages>
<Package>
<Name>ABB Automation Builder Platform Update Package</Name>
<Description>ABB Automation Builder Platform Update Package</Description>
<FileName>ABB Automation Builder Platform.abpkg</FileName>
<FileHash>AjayVishwakarma</FileHash>
<FileDownload>
</FileDownload>
<InstallerData>
<Component>
<Name>ABB Automation Builder Package Manager</Name>
<ID>{F5B05B3F-9FA5-476E-BDD3-DB1397CABF4C}</ID>
<Version>1.0.1.0</Version>
<InstallAlways>true</InstallAlways>
</Component>
</InstallerData>
</Package>
<Package>
<Name>PLC AC500 Update Package</Name>
<Description>PLC AC500 Update Package</Description>
<FileName>PLC - AC500.abpkg</FileName>
<FileHash>8652d588d4c1fe70e0e06a9cf3e09193</FileHash>
<FileDownload>
</FileDownload>
<InstallerData>
<Component>
<Name>Codesys</Name>
<ID>{F8A33E2A-5B6A-474B-8ED2-293B4982D4E6}</ID>
<Version>2.3.9.41</Version>
</Component>
<Component>
<Name>Target Support Package</Name>
<ID>{CC764263-BEF5-4060-AA49-0366AB2E868B}</ID>
<Version>1.0.1.0</Version>
</Component>
<Component>
<Name>Control Builder Plus documentation</Name>
<ID>{484D63DB-1EB6-4F4F-851F-7F7D7D34A396}</ID>
<Version>1.0.1.0</Version>
</Component>
</InstallerData>
</Package>
</Packages>
</ProductUpdate>
XmlPoke task fails to update element value and gives message "Made 0 replacement(s)." I have also tries passing query like
Query="//x:ProductUpdate/x:Packages/x:Package[x:FileName='ABB Automation Builder Platform.abpkg']/x:FileHash" OR Query=".//x:ProductUpdate/Packages/Package[FileName='ABB Automation Builder Platform.abpkg']/FileHash"
I want to know if I am doing it the wrong way? Please note that I don't want to make any changes in the namespace in my xml document.
You're not crazy.
That (hex coded) spaces in the original xml document in the namespace are throwing things off.
I don't have an answer.
But here is a suggestion.
I always use XmlPeek and then "build up" the Query.
(Above with the XmlPeek, I have the top level Query "//ProductUpdate". The Message @(Peeked) will show the xml fragment for there. Then I can build up the query and see the results....and adjust as necessary. )
Anyway, back to the problem:
So the above will work IF you change the original Xml to be
But with the original Xml with the the Hex values for the spaces.......the above won't work. :(
Anyway. That stinks. Its almost like the namespace (in the XmlPeek (or Poke) needs to be "double hexed encoded" or something.
Sorry, I gave it the college try.