ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "broken connection" <brokenconnect...@gmail.com>
Subject Re: Editing an XML file using ant
Date Wed, 19 Sep 2007 23:11:46 GMT
OK Guys,
Finally I figured it out:
XMLTask is very smart enough to understand the namespaces just by adding a
"colon" in front i.e:

<insert path="/:web-app/:mime-mapping[last()]" position="after" file"
insert.xml" />

And everything works fine.

I small thing i noticed is that it adds an empty "xmlns" to all the
mime-mappings i added,i don't know why....i.e.

<mime-mapping xmlns="" >

How can i change the status of this message as "SOLVED".

Thanks a lot guys


On 9/19/07, broken connection <brokenconnection@gmail.com> wrote:
>
> Thanks Dominique,
>
> I understand and XMLTask uses XPath to map to that element and it's not
> able to map to that web-app because of namespace. So, I am trying to use
> this to make it map to the namespace web-app but it's not working:
>
> <insert path="//*[local-name()='web-app']/mime-mapping[last()]"
> position="after" file"insert.xml" />
>
>
> So, how can i make XPath find the namespace enabled web-app that comes
> with Tomcat ???
>
> Thanks
>
>
> On 9/19/07, Dominique Devienne <ddevienne@gmail.com> wrote:
> >
> > On 9/19/07, broken connection <brokenconnection@gmail.com> wrote:
> > > Can someone please suggest anyway to resolve this?? This is strange.
> >
> > <web-app xmlns=" http://java.sun.com/xml/ns/javaee">
> > <web-app>
> >
> > Are two different XML elements. The first belongs to an XML namespace,
> > the second doesn't. XSL is namespace-aware, and thus won't match
> > <web-app xmlns="http://java.sun.com/xml/ns/javaee"> when you tell it
> > to match <web-app>, and vice versa.
> >
> > You could match both, but the problem is that the elements you want to
> > insert need to belong to the "proper" namespace too. <web-app
> > xmlns="http://java.sun.com/xml/ns/javaee"> not only says that the
> > 'web-app' element belongs to the " http://java.sun.com/xml/ns/javaee"
> > namespace, it also sets the "default" namespace. This means that all
> > elements enclosed in 'web-app' also belong to this namespace, while
> > the elements you want to insert, coming from another XML file, also
> > belong to some namespace. XSL doesn't do a "textual" insert, but a
> > "namespace-aware" insert in this case.
> >
> > Sorry if the above is confusing. XSL and XML namespaces both have a
> > learning curve to them. --DD
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message