Hi Holger,
Because that buffer is your final XML destination, it doesn't get written
to until your <xmltask> invocation completes (unlike if it was a copy/cut
destination).
So a separate <print> appears to work:
<target name="main">
<xmltask destbuffer="esbcglobalsetup">
<insert path="/">.....
</xmltask>
<xmltask sourcebuffer="esbcglobalsetup" destbuffer="esbcglobalsetup">
.....
</xmltask>
<xmltask>
<print buffer="esbcglobalsetup"/>
</xmltask>
</target>
Which is a little counterintuitive, I appreciate...
Brian
On Tue, March 25, 2008 16:51, Holger Rauch wrote:
> Hi Brian,
>
> first of all, thanks a lot for your quick reply. But when I make the
> suggested change to sourcebuffer in the 2nd and following invocations,
> I can only get rid of the NPE, but nothing seems to get added to the
> buffer.
> Here's the output I get:
>
> [xmltask] { buffer 'esbcglobalsetup' output - Contents of esbcglobalsetup
> [xmltask] <project basedir="." name="repconf"/>
> [xmltask] } buffer 'esbcglobalsetup' output
>
> (However, the fragment should consist of a <project> root element,
> containing additional properties, which is unfortunately not the case.
>
> Any ideas? Thanks in advance.
>
> Kind regards,
>
> Holger
>
> On Tue, 25 Mar 2008, Brian Agnew wrote:
>
>> My first thought is that you probably want a 'sourcebuffer' on the 2nd
>> XMLTask invocation. A quick test suggests that that appears to work and
>> do
>> what I suspect you want.
>>
>> Having said that, XMLTask shouldn't be throwing an NPE and I will take a
>> look at that and provide a better message (if necessary) or fix it (if
>> that's the real fix).
>>
>> Brian
>>
>> On Tue, March 25, 2008 15:59, Holger Rauch wrote:
>> > Hi,
>> >
>> > I'm trying to add (insert) several XML fragments into the same buffer,
>> but
>> > accross multiple <xmltask> invocations like this:
>> >
>> > 1st invocation:
>> >
>> > <xmltask destbuffer="esbcglobalsetup">
>> > <insert path="/"><![CDATA[<project name="repconf"
>> > basedir="."></project>]]></insert>
>> > </xmltask>
>> >
>> > 2nd, etc. invocation(s):
>> >
>> > <xmltask destbuffer="esbcglobalsetup">
>> > <insert path="/project"
>> > expandProperties="true"><![CDATA[<property
>> > name="user.target.country" value="${user.target.country}"
>> > />]]></insert>
>> > <insert path="/project"
>> > expandProperties="true"><![CDATA[<property
>> name="country.abbrev"
>> > value="${country.abbrev}" />]]></insert>
>> > <insert path="/project"
>> > expandProperties="true"><![CDATA[<property
>> > name="aviation.authority" value="${aviation.authority}"
>> > />]]></insert>
>> > </xmltask>
>> >
>> > Printing the buffer after the final addition and making Ant fail on
>> > purpose:
>> >
>> > <xmltask>
>> > <print buffer="esbcglobalsetup" comment="Contents of
>> esbcglobalsetup" />
>> > </xmltask>
>> >
>> > <fail message="*** Failing on purpose ***" />
>> >
>> > [xmltask] java.lang.NullPointerException
>> > [xmltask] at
>> > com.oopsconsultancy.xmltask.BufferStore.set(BufferStore.java:174)
>> > [xmltask] at
>> > com.oopsconsultancy.xmltask.ant.XmlTask.processDoc(XmlTask.java:715)
>> > [xmltask] at
>> > com.oopsconsultancy.xmltask.ant.XmlTask.execute(XmlTask.java:674)
>> > [xmltask] at
>> > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>> > [xmltask] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown
>> > Source)
>> > [xmltask] at
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> > [xmltask] at java.lang.reflect.Method.invoke(Method.java:585)
>> > [xmltask] at
>> >
>> > org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>> > [xmltask] at org.apache.tools.ant.Task.perform(Task.java:348)
>> > [xmltask] at
>> org.apache.tools.ant.Target.execute(Target.java:357)
>> > [xmltask] at
>> > org.apache.tools.ant.Target.performTasks(Target.java:385)
>> > [xmltask] at
>> > org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>> > [xmltask] at
>> >
>> > org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
>> > [xmltask] at
>> > org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>> > [xmltask] at
>> org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
>> > [xmltask] at
>> > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>> > [xmltask] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown
>> > Source)
>> > [xmltask] at
>> >
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> > [xmltask] at java.lang.reflect.Method.invoke(Method.java:585)
>> > [xmltask] at
>> >
>> > org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>> > [xmltask] at org.apache.tools.ant.Task.perform(Task.java:348)
>> > [xmltask] at
>> > org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>> > [xmltask] at
>> > net.sf.antcontrib.logic.IfTask$ElseIf.execute(IfTask.java:144)
>> > [xmltask] at
>> net.sf.antcontrib.logic.IfTask.execute(IfTask.java:211)
>> > [xmltask] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> > Method)
>> > [xmltask] at
>> >
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> > [xmltask] at
>> >
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> > [xmltask] at java.lang.reflect.Method.invoke(Method.java:585)
>> > [xmltask] at
>> >
>> > org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>> > [xmltask] at
>> > org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
>> >
>> > BUILD FAILED
>> > /home/hrauch/eap-trunk-new/EmpicSuite-trunk/build-scripts/common-includes/common-global-setup.xml:225:
>> > null
>> >
>> > (line 225 is the beginning of the 2nd <insert> fragment).
>> >
>> > Any hints why this happens and how I can work around it?
>> >
>> > Any info/pointers on the above issue will be appreciated.
>> >
>> > Kind regards,
>> >
>> > Holger
>> > -------------------------------------------------------------------------
>> > 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
>> > [email protected]
>> > 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
>>
> --
> =========================================
> Holger Rauch
> Entwicklung Anwendungs-Software
> Systemadministration UNIX
>
> Tel.: +49 / 9131 / 877 - 141
> Fax: +49 / 9131 / 877 - 136
> Email: [EMAIL PROTECTED]
> =========================================
>
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmltask-users