#2 Namespace problem

open
nobody
None
5
2007-11-10
2007-11-10
m.sessa
No

Hi,

I have this problem with namespace:

if I insert some content in the web.xml using

------------
<xmltask source="${project.path}/WebContent/WEB-INF/web.xml" dest="${project.path}/WebContent/WEB-INF/web.xml" preservetype="true" outputter="${ident}">

<remove path="/web-app/servlet[@id='XFireServlet']" />
<remove path="/web-app/servlet-mapping[@id='XFireServletMapping1']" />
<remove path="/web-app/servlet-mapping[@id='XFireServletMapping2']" />

<insert path="//display-name" position="after" file="webIns.xml" />
</xmltask>

------------

the destination <web-app> tag is modified From:

---
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
---

To:

---
<web-app __NS1:xmlns="http://java.sun.com/xml/ns/j2ee" id="WebApp_ID" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:__NS1="http://www.w3.org/2000/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

---

The namespace "__NS1" is added at the web.xml, but this is unwanted.
How I can solve it?

The file webIns.xml inserted is:

----------- START OF FILE

<context-param id="contextConfigLocation">
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/some-servlet.xml</param-value>
</context-param>

<listener id="ContextLoaderListener">
<listener-class>
org.some.ContextLoaderListener
</listener-class>
</listener>

<servlet id="SomeServlet">
<servlet-name>SomeServlet</servlet-name>
<servlet-class>
org.code.SomeServlet
</servlet-class>
</servlet>

<servlet-mapping id="SomeServletMapping1">
<servlet-name>SomeServlet</servlet-name>
<url-pattern>/servlet/SomeServlet/*</url-pattern>
</servlet-mapping>

<servlet-mapping id="SomeMapping2">
<servlet-name>SomeServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>

----------- END OF FILE

Thanks in advance,

Marco

Discussion