Hi I am using WiX 3.0. I have XML-Files like this:
A) <?xml version="1.0" encoding="windows-1252"?> <Config> <Settings> </Settings> </Config> B) <?xml version="1.0" encoding="windows-1252"?> <Config> <Settings> <Key name="Setting1" value="yes"/> <Key name="Setting2" value="1"/> </Settings> </Config> The Key elements can be exists before the installation is running (like B) or not (like A). If the Key element does not exist I want to set the two key elements, but if there are already present I don't want to insert new key elements. Any idea how to do this with XMLConfig or XMLFile? Frist try: <util:XmlConfig Id='I1' VerifyPath="/Config/Settings/[EMAIL PROTECTED]'Setting1'[\]]" Action='create' ElementPath='/Config/Settings' File='c:\Settings.xml' Name='Key' Node='element' On='install' Sequence='1' /> <util:XmlConfig Id='I2' Action='create' VerifyPath="/Config/Settings/[EMAIL PROTECTED]'Setting1'[\]]" ElementPath='/Config/Settings/Key[\[]not(@name)[\]]' File='c:\Settings.xml' Name='name' Node='value' On='install' Sequence='2' Value='Setting1' /> <util:XmlConfig Id='I3' Action='create' VerifyPath="/Config/Settings/[EMAIL PROTECTED]'Setting1'[\]]" ElementPath='/Config/Settings/Key[\[]not(@value)[\]]' File='c:\Settings.xml' Name='value' Node='value' On='install' Sequence='3' Value='yes' /> For A it works fine. At B I get an error (Logfile): Error 25542. Failed to find node: /Config/Settings/Key[not(@name)] in XML file: c:\Settings.xml, system error: -2147020584 Why does XMLConfig try to elevate the ElementPath in sequence 2?(I removed sequence 2 and sequence 3. Sequence 1 will not insert a empty Key element, what is wrong?) Second try: <util:XmlConfig Id='I0' Action='create' ElementPath='/Config/Settings' File='c:\Settings.xml' Name='Key' Node='element'On='install' Sequence='2' /> <util:XmlConfig Id='I1' VerifyPath="/Config/Settings/[EMAIL PROTECTED]'Setting1'[\]]" Action='create' ElementPath='/Config/Settings' File='c:\Settings.xml' Name='Key' Node='element' On='install' Sequence='2' /> <util:XmlConfig Id='I2' Action='create' VerifyPath="/Config/Settings/[EMAIL PROTECTED]'Setting1'[\]]" ElementPath='/Config/Settings/Key[\[]not(@name)[\]]' File='c:\Settings.xml' Name='name' Node='value' On='install' Sequence='3' Value='Setting1' /> <util:XmlConfig Id='I3' Action='create' VerifyPath="/Config/Settings/[EMAIL PROTECTED]'Setting1'[\]]" ElementPath='/Config/Settings/Key[\[]not(@value)[\]]' File='c:\Settings.xml' Name='value' Node='value' On='install' Sequence='4' Value='yes' /> To avoid the error I add an empty Key element, but the result is not satisfying. At A I get an additional empty Key element and at B I get: <?xml version="1.0" encoding="windows-1252"?> <Config> <Settings> <Key name="Setting1" value="yes"/> <Key name="Setting2" value="1"/> <Key name="Setting1" value="yes"/> </Settings> </Config> Hmm why was sequence 2 not done but sequence 3 and 4 was done? How does the action "create" and VerifyPath work together? Any help? Robert ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users