A common problem. You need to tell XPath that all nodes are namespaced. You can specify the local-name() or preceding *every node* with a colon -

<replace path="//:update/:exe/:version/text()" withXML="1.0.${build.number}"/>

(you can use local-name() but it's a little more verbose)

On 28/01/2011 01:27, Abram Adams wrote:
I am trying to do a simple replace in an xml document where the root node has a namespace. Here's my latest attempt:

<xmltask preservetype="true" report="true" source="${DEPLOY_DIR}/installer/update.xml" dest="${DEPLOY_DIR}/installer/update.xml"> <replace path="//*[local-name()='update']/exe/version/text()" withXML="1.0.${build.number}"/>
</xmltask>

The XML document looks like:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<update xmlns="http://ns.riaspace.com/air/framework/update/description/1.1";>
<exe>
<version>1.0.1</version>
</exe>
</update>

For the life of me I cannot get it to replace the <version> text with the text I supply. I've tried all sorts of xPath, but it simply does not find it. Now, if I remove the namespace and use this as the path:

/update/exe/version/text()

It works fine. Problem is the xml file needs to have the namespace. Any ideas?

--Abram


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d


_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

--
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to