This is what we use to update the debug attribute of our web.config. Maybe the 
xmlpeek syntax is similar? 

<xmlpoke file="web.config" 
xpath="/ns:configuration/ns:system.web/ns:compilation/@debug" 
value="${webConfig.debug}" >
 <namespaces>
  <namespace prefix="ns" 
uri="http://schemas.microsoft.com/.NetConfiguration/v2.0"; />
 </namespaces>
</xmlpoke>



----- Original Message ----
From: Andreas Holst <derdres.n...@gmail.com>
To: nant-users@lists.sourceforge.net
Sent: Monday, April 6, 2009 12:14:34 PM
Subject: [NAnt-users] xmlpeek problem

Hi nant users

I have a problem regarding the usage of the "xmlpeek" task.

I am trying to read (later I want to update) an atrribute in a
ClickOnce deployment manifest file
(http://msdn.microsoft.com/en-us/library/k26e96zf.aspx).

Unfortunately Im completely stuck now. Below you can see my build file
and the deployment manifest file.

It seems that the problem has to do with xml namespaces, and
specifically the namespace declaration
xmlns="urn:schemas-microsoft-com:asm.v2" .
I do not know how to add the beforementioned namespace declaration to
the list of namespaces defined for the xmlpeek task.

I have tried the following where I keep the prefix attribute value
empty - but that will not built.

    <namespace prefix="" uri="urn:schemas-microsoft-com:asm.v2"/>

When I remove the declaration xmlns="urn:schemas-microsoft-com:asm.v2"
from the top of the manifest file and use the build file shown below
I obtain the expected result (output:  [echo] peek 2: install ).

Can you guys suggest a solution such that will work with the original
manifest file.

Thanks in advance / derdres

--------------------------------------------------------------------------------------------------------
1) nant snippet:
-------------------

<?xml version="1.0"?>
<project name="Xpath.build" default="xml.peeker02"
xmlns="http://nant.sf.net/nightly/2006-03-08-0.85/nant.xsd";>
    <property name="hello.string" value="Hello World" />

    <target name="xml.peeker02">
        <xmlpeek
            file="test.xml"
            xpath="//dependentAssembly/@dependencyType"
            property="peek.result02"
            >
            <namespaces>
                <namespace prefix="dsig"
uri="http://www.w3.org/2000/09/xmldsig#"/>

                <namespace prefix="asmv1"
uri="urn:schemas-microsoft-com:asm.v1"/>
                <namespace prefix="asmv2"
uri="urn:schemas-microsoft-com:asm.v2"/>
                <namespace prefix="xrml"
uri="urn:mpeg:mpeg21:2003:01-REL-R-NS"/>
                <namespace prefix="xsi"
uri="http://www.w3.org/2001/XMLSchema-instance"/>
            </namespaces>
        </xmlpeek>
        <!--<namespace prefix="" uri="urn:schemas-microsoft-com:asm.v2"/>-->


        <echo message="peek 2: ${peek.result02}"/>
    </target>
</project>

--------------------------------------------------------------------------------------------------------
2) deploy manifest file
--------------------------------

<?xml version="1.0" encoding="utf-8"?>

<!--THIS WORKS -->
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1
assembly.adaptive.xsd" manifestVersion="1.0"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#";
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>


<!--THIS DOES NOT WORK -->
<!--<asmv1:assembly
xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1
assembly.adaptive.xsd" manifestVersion="1.0"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#";
xmlns="urn:schemas-microsoft-com:asm.v2"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>-->


    <assemblyIdentity name="AutomaticDeployTakeOne.application"
version="6.0.0.0" publicKeyToken="42aefb0b73206a82" language="neutral"
processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1"
/>
  <description asmv2:publisher="Sayed Y. Hashimi"
asmv2:product="AutomaticDeployTakeOne"
asmv2:supportUrl="http://localhost/";
xmlns="urn:schemas-microsoft-com:asm.v1" />
  <deployment install="true" mapFileExtensions="true">
    <subscription>
      <update>
        <expiration maximumAge="0" unit="days" />
      </update>
    </subscription>
    <deploymentProvider
codebase="http://localhost/AutomaticDeployTakeOne/AutomaticDeployTakeOne.application";
/>
  </deployment>
  <dependency>
    <dependentAssembly dependencyType="install"
codebase="AutomaticDeployTakeOne.exe.manifest" size="7055">
      <assemblyIdentity name="AutomaticDeployTakeOne.exe"
version="6.0.0.0" publicKeyToken="42aefb0b73206a82" language="neutral"
processorArchitecture="msil" type="win32" />
      <hash>
        <dsig:Transforms>
          <dsig:Transform
Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"; />
        <dsig:DigestValue>8ALYvYLFRANMLI1laqKKdFgKn8A=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
<publisherIdentity name="CN=atom_powerhouse\Andreas"
issuerKeyHash="35cd5fdd8504343f486ff1752c5fa8168020e223" /><Signature
Id="StrongNameSignature"
xmlns="http://www.w3.org/2000/09/xmldsig#";><SignedInfo><CanonicalizationMethod
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"; /><SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"; /><Reference
URI=""><Transforms><Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature";
/><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#";
/></Transforms><DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1";
/><DigestValue>TtJYBNFkqOXxL3j1dwbI4hJ9+To=</DigestValue></Reference></SignedInfo><SignatureValue>Tgvsw1DQsGwwRjTPvmLKQTtQFTpjQPY+etNXeqVJahE33aLsl6Plx63VFj6d/s7qR4dtiEI/xOQpfRBThXEeq/Z/ubyGtC/uXycjOWAMr/fggCiU6Dkl22b8aZ2eR1Uusp96uzBxfpO6uNRPeCndbec/6qYyl5FXCoNAd4YSpoQ=</SignatureValue><KeyInfo
Id="StrongNameKeyInfo"><KeyValue><RSAKeyValue><Modulus>v0AcJvnMyePDuHr11WrhOQLngxvaF6ml9Zb1QuOXzu0UWKOfnka2mXQps2dGIK6D7R5srK2di3mJ5CR6ya1XaEZ7nDhGZEdN6lBseQRyhtBscH1GzzfOWwrwUUB+mrjrlemv9CobCrGSMJtqEaz9meD572atCxQ82307VcumE7c=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><msrel:RelData
xmlns:msrel="http://schemas.microsoft.com/windows/rel/2005/reldata";><r:license
xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS"
xmlns:as="http://schemas.microsoft.com/windows/pki/2005/Authenticode";><r:grant><as:ManifestInformation
Hash="3af97d12e2c80677f5782ff1e5a864d10458d24e" Description=""
Url=""><as:assemblyIdentity name="AutomaticDeployTakeOne.application"
version="6.0.0.0" publicKeyToken="42aefb0b73206a82" language="neutral"
processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1"
/></as:ManifestInformation><as:SignedBy
/><as:AuthenticodePublisher><as:X509SubjectName>CN=atom_powerhouse\Andreas</as:X509SubjectName></as:AuthenticodePublisher></r:grant><r:issuer><Signature
Id="AuthenticodeSignature"
xmlns="http://www.w3.org/2000/09/xmldsig#";><SignedInfo><CanonicalizationMethod
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"; /><SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"; /><Reference
URI=""><Transforms><Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature";
/><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#";
/></Transforms><DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1";
/><DigestValue>XIbUXvqYuzaZNL6ktcCOnJ+2MCM=</DigestValue></Reference></SignedInfo><SignatureValue>MHUzVRPfgiuzlzYa9GHn/hARuM93Vx0W1IVbRa5c/kwTFKzLmpaLaWL+zVu6kTeJ8lt9N57lnKstA26ImAMB0owxqXVShJgK+TMN+LUl0O/QcRBjWv3SuXCFnArII250Bz4VFpcGnXe1MC4FOl1Z8QetIuPtbE4ZP8D8u0Qq0E4=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>v0AcJvnMyePDuHr11WrhOQLngxvaF6ml9Zb1QuOXzu0UWKOfnka2mXQps2dGIK6D7R5srK2di3mJ5CR6ya1XaEZ7nDhGZEdN6lBseQRyhtBscH1GzzfOWwrwUUB+mrjrlemv9CobCrGSMJtqEaz9meD572atCxQ82307VcumE7c=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIIB9TCCAV6gAwIBAgIQKQVGesFYfLJMHkAXGs6y2jANBgkqhkiG9w0BAQUFADA5MTcwNQYDVQQDHi4AYQB0AG8AbQBfAHAAbwB3AGUAcgBoAG8AdQBzAGUAXABBAG4AZAByAGUAYQBzMB4XDTA5MDQwMTEwNTgzMVoXDTEwMDQwMTE2NTgzMVowOTE3MDUGA1UEAx4uAGEAdABvAG0AXwBwAG8AdwBlAHIAaABvAHUAcwBlAFwAQQBuAGQAcgBlAGEAczCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAv0AcJvnMyePDuHr11WrhOQLngxvaF6ml9Zb1QuOXzu0UWKOfnka2mXQps2dGIK6D7R5srK2di3mJ5CR6
ya1XaEZ7nDhGZEdN6lBseQRyhtBscH1GzzfOWwrwUUB+mrjrlemv9CobCrGSMJtqEaz9meD572atCxQ82307VcumE7cCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBeRu6/GOvxQfe8A3mA/9xFhsvW3WflkLXRTujDC1wXONtKoPH5WDuWSj6crhIVoql1tK+lI9mBPVskrm1U0LdkCJCPF7u9I4EuDkWSwCO4uSHO8Fuaw6GvS6r7MXNtSi50dALsl2eB6RqbNaNIF7/MFWsIuW9gVHoyNTF+Sdt6WA==</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>

------------------------------------------------------------------------------
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to