Looks like the following would work:
<uncomment path="/*[local-name()='web-app']/comment()[4]" />
or even
<uncomment path="/:web-app/comment()[4]" />
What i was missing initially was the ':' before the web-app root.
Now when i get the altered file output, it does add an empty xmlns="" to the
following:
<filter xmlns="">
<filter-name>authFilter</filter-name>
<filter-class>blah</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Not sure if it will cause an issue or not when it is deployed...
Thanks to all.
________________________________
From: Brian Agnew <br...@oopsconsultancy.com>
To: Dan Kilburn <shooting_star2...@yahoo.com>
Cc: "xmltask-users@lists.sourceforge.net" <xmltask-users@lists.sourceforge.net>
Sent: Friday, July 20, 2012 3:27 AM
Subject: Re: [Xmltask-users] problem with using uncomment
Are you sure that uncomment() path is correct ? Remember that XPath
indexes from 1, not 0!
On Thu, July 19, 2012 20:04, Dan Kilburn wrote:
> Hi, I am having an issue where I want to make use of the xmltask uncomment
> feature.
>
> I have something of the following:
>
>
> <code>
>
> web.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="someId" blah blah blah>
>
> <!-- Uncomment this filter when deploying to an SSO environment
> <filter>
> <filter-name>authFilter</filter-name>
> <filter-class>blah</filter-class>
> </filter>
> <filter-mapping>
> <filter-name>springSecurityFilterChain</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> -->
> </web-app>
>
> build.xml:
>
>
> <taskdef name="xmltask"
> classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
> <target name="alterWebXml">
> <xmltask source="WebContent/WEB-INF/web.xml" dest="D:/deployment/web.xml"
> report="true">
> <uncomment path="/web-app/comment()[4]" />
> </xmltask>
> </target>
>
> </code>
>
>
> I am able to successfully generate the new web.xml file in the given
> directory. It reads the old one in, and writes the new one to the given
> dest directory.
> The problem is, it's not removing the comments where I said to remove them
> at. I know it has something to do with the path of the uncomment itself.
> I
> get no error, it simply never removes the comment. It is coming off of the
> root 'web-app' element inside of the web.xml file but according to the
> documentation,
> I should be able to identify which comment in the document that I want to
> remove by comment()[index].
>
> Any and all help that anyone could suggest as to what I am doing wrong
> would greatly be appreciated...
>
> Thank you,
> dan ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> 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
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users