Re: [WiX-users] Help with adding new elements using XMLConfig

2014-04-15 Thread Michael Turner
Uma,

Apologies for the delayed response.  If you haven't figured it out already,
you only need to remove the parent 'SnippetDir' node, and all of its
children will be removed with it.  However, you will need to be clever with
your XPath to make sure you select the correct 'SnippetDir' node for removal
-- e.g., reference something unique from the "More Stuff" part.

For example, something like this:

\snippetsindex.xml"
Node="element" ElementPath="//SnippetCollection//Language"
VerifyPath="SnippetDir[\[]MoreStuff/@Foo='bar'[\]]" />

You should replace the MoreStuff/@Foo='bar' qualifier with something that
uniquely describes the SnippetDir that you're adding on installation. 
Remember that you need to use the "[\[]" and "[\]]" to escape the square
brackets that would otherwise be interpreted as MSI's "[PropertyName]"
syntax.

The XmlConfig Element documentation is not very clear on this point, but in
my experience, for a "delete element" action, ElementPath points to the
parent of the element you want to delete (so the same ElementPath you used
when creating it as Node="document"), VerifyPath is interpreted relative to
the ElementPath, and VerifyPath specifies what you want to delete.

(I didn't repeat the xmlns:util namespace declaration on the above example;
you should put this on a higher-level element in your file so that you don't
have to keep repeating it.)

Regards,
Mike


uharano wrote
> Hi Mike,
> I got the installation to work using the Node="document" method. The xml
> content is now correctly written during install mode.
> To remove the xml content during uninstall, I need to specify each node in
> a sequence (working from the child elements to outer elements), correct? I
> cannot use the Node="document" and pass the entire xml snippet?
> 
> Thanks!
> Uma





--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Help-with-adding-new-elements-using-XMLConfig-tp7593764p7594140.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] Help with adding new elements using XMLConfig

2014-03-28 Thread Uma Harano
Hi Mike,
I got the installation to work using the Node="document" method. The xml 
content is now correctly written during install mode.
To remove the xml content during uninstall, I need to specify each node in a 
sequence (working from the child elements to outer elements), correct? I cannot 
use the Node="document" and pass the entire xml snippet?

Thanks!
Uma-

-Original Message-
From: Michael Turner [mailto:mcturner...@gmail.com] 
Sent: Wednesday, March 26, 2014 9:16 AM
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] Help with adding new elements using XMLConfig

Uma,

First of all, I don't think you can insert XML before a given node using
XmlConfig; you can only append a new child to a given parent node.
(http://stackoverflow.com/q/8224918)

Also, there are two nodes that match your XPath expression, and XmlConfig
only uses the first match.  Since you know that the node you have just added
will always be the last one (due to the append behavior), you should try
this XPath for your 1002 expression instead:

ElementPath="//SnippetCollection//Language/SnippetDir[\[]last()[\]]"

Notice that you must escape the square brackets per
http://msdn.microsoft.com/library/aa368609.aspx

I am not certain whether the last() function actually works on XmlConfig,
but this should get you closer.  If that does not work, then you can try
this instead:

  <util:XmlConfig On="install" Action="create"
Id="CreateSnippetDir" Node="document"
File="<Path to Xml>\snippetsindex.xml"
ElementPath="//SnippetCollection//Language"
  xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">;
 
<![CDATA[<SnippetDir><OnOff>Off</OnOff><!-- More
Stuff --></SnippetDir>]]>
  </util:XmlConfig>

If you use this, it can replace both of your XmlConfig elements, since it
combines them into a single operation.  Note the Node="document", which lets
you specify the XML content to insert, as inner-text of the XmlConfig node. 
I am not sure whether the Node="document" construct treats the inner-text as
a "Formatted String" (http://msdn.microsoft.com/library/aa368609.aspx) or
not, so if your "More Stuff" contains any square brackets or [PropertyName]
expressions, you may need to experiment to see how it behaves.

Regards,
Mike


uharano wrote
> I want to add the highlighted lines with my setup:
> 
> 
> 
> <!-- BEGIN HIGHLIGHT -->
> 
> 
> 
> 
> Off
> 
> <!-More stuff -->
> 
> 
> <!-- END HIGHLIGHT -->
> 
> 
> 
> 
> On
> 
> 
> 
> true
> 
> 
> 
> 1033
> 
> 
> 
> %InstallRoot%\VC#\Snippets\%LCID%\Visual C#\
> 
> 
> 
> Visual C#
> 
> 
> 
> 
> 
> 
> In Wix these are my lines of code:
>   <util:XmlConfig On="install" Action="create"
> Id="CreateSnippetDir" Node="element"
> File="<Path to Xml>\snippetsindex.xml"
> ElementPath="//SnippetCollection//Language" Sequence="1001"
>   xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
> Name="SnippetDir"  />
>   <util:XmlConfig On="install" Action="create"
> Id="CreateOnOff" Node="element" File="<Path to
> Xml>\snippetsindex.xml\snippetsindex.xml"
> ElementPath="//SnippetCollection//Language/SnippetDir" Sequence="1002"
>   xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
> Name="OnOff" Value="off" />





--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Help-with-adding-new-elements-using-XMLConfig-tp7593764p7593776.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


--
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] Help with adding new elements using XMLConfig

2014-03-26 Thread Uma Harano
Hi Mike,
Option 1 did not work - I got a message saying: 
"Failed to find snippet node //SnippetCollection//Language/SnippetDir[last()]"

With option 2 (which was very promising and such a simple solution for me) I 
get this error in the MSI log. The setup just rolls back immediately:
"ExecXmlConfig:  Error 0x8007006e: Failed to load value as document."

Note: for option 2, I do not have any square brackets or properties that need 
to be escaped. I even tried it with a very simple one line XML.

Thanks!
Uma-





-Original Message-
From: Michael Turner [mailto:mcturner...@gmail.com] 
Sent: Wednesday, March 26, 2014 9:16 AM
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] Help with adding new elements using XMLConfig

Uma,

First of all, I don't think you can insert XML before a given node using 
XmlConfig; you can only append a new child to a given parent node.
(http://stackoverflow.com/q/8224918)

Also, there are two nodes that match your XPath expression, and XmlConfig only 
uses the first match.  Since you know that the node you have just added will 
always be the last one (due to the append behavior), you should try this XPath 
for your 1002 expression instead:

ElementPath="//SnippetCollection//Language/SnippetDir[\[]last()[\]]"

Notice that you must escape the square brackets per 
http://msdn.microsoft.com/library/aa368609.aspx

I am not certain whether the last() function actually works on XmlConfig, but 
this should get you closer.  If that does not work, then you can try this 
instead:

  <util:XmlConfig On="install" Action="create" 
Id="CreateSnippetDir" Node="document" File="<Path 
to Xml>\snippetsindex.xml"
ElementPath="//SnippetCollection//Language"
  xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">;
 
<![CDATA[<SnippetDir><OnOff>Off</OnOff><!-- More Stuff 
--></SnippetDir>]]>
  </util:XmlConfig>

If you use this, it can replace both of your XmlConfig elements, since it 
combines them into a single operation.  Note the Node="document", which lets 
you specify the XML content to insert, as inner-text of the XmlConfig node. 
I am not sure whether the Node="document" construct treats the inner-text as a 
"Formatted String" (http://msdn.microsoft.com/library/aa368609.aspx) or not, so 
if your "More Stuff" contains any square brackets or [PropertyName] 
expressions, you may need to experiment to see how it behaves.

Regards,
Mike


uharano wrote
> I want to add the highlighted lines with my setup:
> 
> 
> 
> <!-- BEGIN HIGHLIGHT -->
> 
> 
> 
> 
> Off
> 
> <!-More stuff -->
> 
> 
> <!-- END HIGHLIGHT -->
> 
> 
> 
> 
> On
> 
> 
> 
> true
> 
> 
> 
> 1033
> 
> 
> 
> %InstallRoot%\VC#\Snippets\%LCID%\Visual C#\ 
> 
> 
> Visual C#
> 
> 
> 
> 
> 
> 
> In Wix these are my lines of code:
>   <util:XmlConfig On="install" 
> Action="create" Id="CreateSnippetDir" 
> Node="element" File="<Path to Xml>\snippetsindex.xml"
> ElementPath="//SnippetCollection//Language" Sequence="1001"
>   xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
> Name="SnippetDir"  />
>   <util:XmlConfig On="install" 
> Action="create" Id="CreateOnOff" 
> Node="element" File="<Path to 
> Xml>\snippetsindex.xml\snippetsindex.xml"
> ElementPath="//SnippetCollection//Language/SnippetDir" Sequence="1002"
>   xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
> Name="OnOff" Value="off" />





--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Help-with-adding-new-elements-using-XMLConfig-tp7593764p7593776.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the 
definitive new guide to graph databases and their applications. Written by 
three acclaimed leaders in the field, this first edition is now available. 
Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


--
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] Help with adding new elements using XMLConfig

2014-03-26 Thread Michael Turner
Uma,

First of all, I don't think you can insert XML before a given node using
XmlConfig; you can only append a new child to a given parent node.
(http://stackoverflow.com/q/8224918)

Also, there are two nodes that match your XPath expression, and XmlConfig
only uses the first match.  Since you know that the node you have just added
will always be the last one (due to the append behavior), you should try
this XPath for your 1002 expression instead:

ElementPath="//SnippetCollection//Language/SnippetDir[\[]last()[\]]"

Notice that you must escape the square brackets per
http://msdn.microsoft.com/library/aa368609.aspx

I am not certain whether the last() function actually works on XmlConfig,
but this should get you closer.  If that does not work, then you can try
this instead:

  ;
 
Off]]>
  

If you use this, it can replace both of your XmlConfig elements, since it
combines them into a single operation.  Note the Node="document", which lets
you specify the XML content to insert, as inner-text of the XmlConfig node. 
I am not sure whether the Node="document" construct treats the inner-text as
a "Formatted String" (http://msdn.microsoft.com/library/aa368609.aspx) or
not, so if your "More Stuff" contains any square brackets or [PropertyName]
expressions, you may need to experiment to see how it behaves.

Regards,
Mike


uharano wrote
> I want to add the highlighted lines with my setup:
> 
> 
> 
> 
> 
> 
> 
> 
> Off
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On
> 
> 
> 
> true
> 
> 
> 
> 1033
> 
> 
> 
> %InstallRoot%\VC#\Snippets\%LCID%\Visual C#\
> 
> 
> 
> Visual C#
> 
> 
> 
> 
> 
> 
> In Wix these are my lines of code:
>    Id="CreateSnippetDir" Node="element"
> File="\snippetsindex.xml"
> ElementPath="//SnippetCollection//Language" Sequence="1001"
>   xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
> Name="SnippetDir"  />
>    Id="CreateOnOff" Node="element" File=" Xml>\snippetsindex.xml\snippetsindex.xml"
> ElementPath="//SnippetCollection//Language/SnippetDir" Sequence="1002"
>   xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
> Name="OnOff" Value="off" />





--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Help-with-adding-new-elements-using-XMLConfig-tp7593764p7593776.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users