My initial thought is that the <!CDATA[ section below is parsed as a
completely new XML file, so I would expect that would require a namespace
declaration as well. You're effectively inserting one standalone doc into
another.

If you still have no joy I shall investigate further.

Namespaces are a bit of a pain - both within XMLTask and generally. Any
comments (and this goes out to anyone reading) how we should be handling
this nicely will be gratefully received!

Brian

On Mon, February 11, 2008 22:03, Rob Lieou wrote:
> I spoke too soon ...
> After I add the namespace (ex1) to the xml file, I run
> the second xmltask to insert a new xml statement to
> it.
> And I have this error
> Caused by: org.xml.sax.SAXParseException: The prefix
> "ex1" for element "ex1:abc" is not bound.
>
> Brian, do you happen to know why? The namespace "ex1"
> should be in the xml file.  Thanks.
>
> <target name="ex0" depends="init-taskdefs">
>     <xmltask source="${basedir}/ex-1.xml"
>        dest="${basedir}/ex-2.xml">
>        <attr path="/jbi" attr="xmlns:ex1"
>          value="urn:com.example-1"/>
>     </xmltask>
>     <xmltask source="${basedir}/ex-2.xml"
>        dest="${basedir}/ex-3.xml">
>        <insert path="/:jbi/:services"
> position="after">
>           <![CDATA[
>             <ex1:abc>This is just a test</ex1:abc>
>             ]]>
>        </insert>
>    </xmltask>
> </target>
>
> --- Brian Agnew <[EMAIL PROTECTED]> wrote:
>
>> Ah. Of course. Thx for the feedback.
>> Rob Lieou wrote:
>> > Thank you Brian, it works with a tiny modification
>> due
>> > to namespaces.
>> > <attr path="/:jbi" attr="xmlns:ex1"
>> > value="urn:com.example-1"/>
>> >
>> > --- Brian Agnew <[EMAIL PROTECTED]> wrote:
>> >
>> >
>> >> Try:
>> >>
>> >> <attr path="/jbi" attr="xmlns:ex1"
>> >> value="urn:com.example-1"/>
>> >>
>> >> etc.
>> >>
>> >> Brian
>> >>
>> >> On Sun, February 10, 2008 22:31, Rob Lieou wrote:
>> >>
>> >>> Hi all,
>> >>> This is my first time using XmlTask and would
>> like
>> >>>
>> >> to
>> >>
>> >>> know if I can add xmlns to the root element.
>> >>>
>> >>> For instance, I have this xml file. I use the
>> >>>
>> >> insert
>> >>
>> >>> command to insert some xml to this file that
>> >>>
>> >> require
>> >>
>> >>> new namespaces. So, can I use the XmlTask to
>> >>>
>> >> update
>> >>
>> >>> the   root element which in this case is the jbi
>> >>>
>> >> node.
>> >>
>> >>> I would like to add the following new xml
>> >>>
>> >> namespaces
>> >>
>> >>> xmlns:ex1="urn:com.example-1"
>> >>> xmlns:ex2="urn:com.example-2"
>> >>>
>> >>> you get my point. Does anyone know how to do it?
>> >>> Thanks.
>> >>>
>> >>> <?xml version="1.0" encoding="UTF-8"
>> >>> standalone="yes"?>
>> >>> <jbi xmlns="http://java.sun.com/xml/ns/jbi";
>> >>>
>> >>>
>> >
> xmlns:ns1="http://enterprise.netbeans.org/bpel/BpelExample/BpelExample";
>> >
>> >>> xmlns:ns2="urn:com.examples"
>> >>>
>> >>>
>> >
> xmlns:ns3="http://j2ee.netbeans.org/wsdl/BpelExample";
>> >
>> >>> version="1.0">
>> >>> <services binding-component="true">
>> >>> <provides endpoint-name="BpelExamplePort"
>> >>> interface-name="ns2:BpelExampleManager"
>> >>> service-name="ns2:BpelExampleService"/>
>> >>> <consumes endpoint-name="BpelExamplePort"
>> >>> interface-name="ns3:BpelExamplePortType"
>> >>> service-name="ns3:BpelExampleService"/>
>> >>> </services>
>> >>> </jbi>
>> >>>
>> >>>
>> >>>
>> >>>
>> >
> ____________________________________________________________________________________
>> >
>> >>> Be a better friend, newshound, and
>> >>> know-it-all with Yahoo! Mobile.  Try it now.
>> >>>
>> >>>
>> >
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>> >
>> >>>
>> >>>
>> >
> -------------------------------------------------------------------------
>> >
>> >>> This SF.net email is sponsored by: Microsoft
>> >>> Defy all challenges. Microsoft(R) Visual Studio
>> >>>
>> >> 2008.
>> >>
>> >
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> >
>> >>> _______________________________________________
>> >>> 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
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> >
> ____________________________________________________________________________________
>> > Never miss a thing.  Make Yahoo your home page.
>> > http://www.yahoo.com/r/hs
>> >
>> >
> -------------------------------------------------------------------------
>> > This SF.net email is sponsored by: Microsoft
>> > Defy all challenges. Microsoft(R) Visual Studio
>> 2008.
>> >
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> > _______________________________________________
>> > 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         brian @
>> oopsconsultancy.com
>> Tel: +44 (0)7720 397526
>> Fax: +44 (0)20 8682 0012
>
>
>
>       
> ____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page.
> http://www.yahoo.com/r/hs
>
> -------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> 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





-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to