I've had lots of issues with the XML Pattern stuff with namespaces.  I 
eventually wrote a little jscript that let me test my pattern until I finally 
got it right.  Then I dropped it in with variables and boom:

if (2 > WScript.Arguments.length)
{
    WScript.Echo("Must specify both the file and the XSL Path to query.");
    WScript.Quit(1);
}

WScript.Echo("Opening File: " + WScript.Arguments(0));

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmlDoc.async = false;
xmlDoc.load(WScript.Arguments(0));

if (0 != xmlDoc.parseError.errorCode)
{
    var myErr = xmlDoc.parseError;
    WScript.Echo("You have error " + myErr.reason);
}
else
{
    WScript.Echo("Query: " + WScript.Arguments(1));
    WScript.Echo();

    // xmlDoc.setProperty("SelectionLanguage", "XPath");
    currNode = xmlDoc.selectSingleNode(WScript.Arguments(1));
    if (null == currNode)
    {
        WScript.Echo("Nothing found.");
    }
    else
    {
        WScript.Echo(currNode.text);
    }
}


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shaun Wilde
Sent: Friday, January 19, 2007 1:20 AM
To: Matthew Janulewicz; wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] xmlfile and namespaces

Sorry I should have said I am using WIX V2 (not 3) and
I have the correct escaping as you can see in my example.

Unfortunately web.config don't tend to have any namespaces
defined in them and I don't have issue with those files - its an xml
file that has namespaces defined within it that is causing grief.

Shaun


________________________________
Subject: RE: [WiX-users] xmlfile and namespaces
Date: Thu, 18 Jan 2007 13:04:03 -0800
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; wix-users@lists.sourceforge.net

I'm not totally in tune with xml paths and whatnot, but I hacked through an 
example and came up with this:



<util:XmlFile Id="RequireCorrectCaptchaCode" Action="setValue" 
ElementPath="/configuration/appSettings/[EMAIL 
PROTECTED]'RequireCorrectCaptchaCode'[\]]/@value" File="[INSTALLDIR]Web.config" 
Value="[[TARGET_ENVIRONMENT].CAPTCHA_REQUIRED]" />



The escape characters and whatnot are hardly intuitive and it took forever to 
get it to work, but this is the syntax I use in our installers to change values 
in our config files. Hope this helps.





-Matt



________________________________

From: Shaun Wilde [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 18, 2007 12:00 PM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] xmlfile and namespaces



I am trying to use xmlfile on an file with namespaces I would therefore 
construct my query to look like this

ElementPath="//*[\[]local-name()='deployment'[\]]/*[\[]local-name()='deploymentProvider'[\]]/@codebase"

but I get the following error

ExecXmlFile:  Error 0x80004005: failed to find node: //*/*/@codebase in XML 
file: C:\Program Files\XXX\XXX.application
MSI (s) (20!60) [19:44:10:257]: Product: XXX Service -- Error 25532. Failed to 
find node: 
//*[local-name()='deployment']/*[local-name()='deploymentProvider']/@codebase 
in XML file: C:\Program Files\XXX\XXX.application, system error: -2147467259

only 1 node matches that query in the file can xmlfile handle such xpath 
queries?

If not how is one to handle xml files that have many namespaces within them 
since there does not appear to be a way of adding namespace information into 
the xmlfile CA

Shaun

________________________________

Be one of the first to try Windows Live 
Mail.<http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d>

________________________________
Be one of the first to try Windows Live 
Mail.<http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to