Ok so try this instead
(adjust the xmlpeek.file attribute accordingly):
<project name="TestProject" default="build">
<target name="build">
<xmlpeek file="MSI1.wxs" xpath="/x:Wix/x:[EMAIL PROTECTED] =
'1CAC5BF0-B2AD-447B-A7D9-DE4D5572A1CB']/@Version" property="xml.property">
<namespaces>
<namespace prefix="x"
uri="http://schemas.microsoft.com/wix/2003/01/wi"/>
</namespaces>
</xmlpeek>
<echo message="${xml.property}"/>
</target>
</project>
If you don't want or need to be
specific on the Product Id then remove everything from the start
[ to the last ] in the XPath attribute.
Also your first snippet didn't have enough of the document there so that is why
a lot of people including myself suggested adding the end
tags.
-----Original Message-----
From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of Kedziora, Rebecca
Sent: Thursday, October 20, 2005 2:10
PM
To: nant-users@lists.sourceforge.net
Subject: RE: [Nant-users] Xpath
guru needed...
Still does not work.
Also when you wanted me
to chagne the XML file to close the \> Product it would say the file is now
invalid. If I leave my file alone it doesn't complain about it being
invalid.
<target name="version" description="Get and Update the
version in SMC.WXS file.">
<xmlpeek file="${pwd}\MSI1.wxs"
xpath="/x:Wix/x:Product/@x:Version"
property="xml.property">
<namespaces>
<namespace prefix="x"
uri="
http://schemas.microsoft.com/wix/2003/01/wi"
/>
</namespaces>
</xmlpeek>
<echo
message="${xml.property}"/>
</target>
-----Original
Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
On Behalf Of Guy Metz
Sent: Thursday, October 20, 2005 3:57 PM
To:
nant-users@lists.sourceforge.net
Subject: RE: [Nant-users] Xpath guru
needed...
Because the Wix document has a namespace your Xpath
_expression_ must also reference the namespace. Remember that xpath matches on
fully qualified names. Try the following (sorry in advance if I screwed up the
syntax)
<xmlpeek
file="${pwd}\MSI1.wxs"
xpath="/x:Wix/x:Product/@x:Version"
property="xml.property">
<namespaces>
<namespace prefix="x"
url=""http://schemas.microsoft.com/wix/2003/01/wi">http://schemas.microsoft.com/wix/2003/01/wi"
/>
</namespaces>
</xmlpeek>
> -----Original Message-----
> From: Kedziora,
Rebecca [mailto:[EMAIL PROTECTED]]
>
Sent: Thursday, October 20, 2005 4:44 PM
> To:
nant-users@lists.sourceforge.net
> Subject: RE: [Nant-users] Xpath guru
needed...
>
> This is what I am using in my build file to get the
Version but it
> doesn't work.
>
>
> <property
name="xml.property" value="unknown" />
>
> <target
name="version" description="Get and Update the version in
> SMC.WXS
file.">
> <xmlpeek
file="${pwd}\MSI1.wxs" xpath="/Wix/Product/@Version"
>
property="xml.property">
>
</xmlpeek>
>
<echo message="${xml.property}"/>
>
</target>
>
>
> -----Original Message-----
> From:
[EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
On Behalf Of Kedziora,
> Rebecca
> Sent: Thursday, October 20,
2005 3:36 PM
> To: nant-users@lists.sourceforge.net
> Subject: RE:
[Nant-users] Xpath guru needed...
>
>
> I opened up this
document in IDE and the XML editor and it looks fine.
>
> Even with
this document I get the same erros that the node is
not
valid.
>
>
>
> -----Original Message-----
>
From: Martin Gainty [mailto:[EMAIL PROTECTED]]
> Sent:
Thursday, October 20, 2005 3:28 PM
> To: Eric Fetzer; Kedziora, Rebecca;
nant-users@lists.sourceforge.net
> Subject: Re: [Nant-users] Xpath guru
needed...
>
>
> <?xml version="1.0"?>
> <Wix
xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
>
<Product Id="431EB16A" Name="Management Center" Language="1033"
>
Version="3.0.0.100" Manufacturer="Corporation"/> </Wix>
>
>
Note the end tag /> at the end of the <Product Tag
>
> If you
want a way to catch malformed XML errors just open the xml
> document in
your IDE OR Open your XML document with XML Parser such
> as XMLSpy
available at the Altova XMLSpy site
> http://www.altova.com/download_spy_enterprise.html
>
>
Hope this works for you,
> Martin -
> Etats Unis
> -----
Original Message -----
> From: "Eric Fetzer"
<[EMAIL PROTECTED]>
> To: "Kedziora, Rebecca"
<[EMAIL PROTECTED]>;
>
<nant-users@lists.sourceforge.net>
> Sent: Thursday, October 20,
2005 4:03 PM
> Subject: Re: [Nant-users] Xpath guru
needed...
>
>
> >
/Wix/Product/[EMAIL PROTECTED]'431EB16A']/@Version
> >
> >
>
>
> > --- "Kedziora, Rebecca"
> >
<[EMAIL PROTECTED]> wrote:
> >
> >>
Anyone,
> >>
> >> Trying to use the xmlpeek to retrieve
the value of an attribute.
> >>
> >> I am trying to get
the Version:
> >>
> >> <?xml
version="1.0"?>
> >>
> >> <Wix
> >>
xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
>
>>
> >> <Product Id="431EB16A" Name="Management Center"
Language="1033"
> >> Version="3.0.0.100"
Manufacturer="Corporation">
> >>
> >>
</Wix>
> >>
> >> I tried several ways to use xpath
and it keeps tellings me "No
> >> matching nodes found for Xpath
_expression_".
> >>
> >> Does anyone know how to get xpath
to work here?
> >>
> >> Thanks,
> >>
>
>> Rebecca
> >>
> >>
> >>
>
>>
> >
> >
> >
> >
> >
__________________________________
> > Yahoo! Music Unlimited
>
> Access over 1 million songs. Try it free.
> > http://music.yahoo.com/unlimited/
>
>
> >
> >
-------------------------------------------------------
> > This SF.Net
email is sponsored by:
> > Power Architecture Resource Center: Free
content, downloads,
> > discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
>
> _______________________________________________
> > Nant-users
mailing list
> > Nant-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nant-users
>
>
>
>
>
-------------------------------------------------------
> This SF.Net
email is sponsored by:
> Power Architecture Resource Center: Free content,
downloads,
discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
>
_______________________________________________
> Nant-users mailing
list
> Nant-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nant-users
-------------------------------------------------------
This
SF.Net email is sponsored by:
Power Architecture Resource Center: Free
content, downloads,
discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Nant-users
mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users