Brian,

 

I was just adding the dest to temp file to get this going. Thanks for the quick response.

 

Pete

 


From: Brian Agnew [mailto:brian@oopsconsultancy.com]
Sent: Monday, June 13, 2005 11:07 AM
To: Pete Hale
Cc: xmltask-users@lists.sourceforge.net; phale@wispertel.net
Subject: Re: [Xmltask-users] xml task OutOfMemoryError

 

Interesting. You're copying

<b name="firstb"/>

into 'copyb'

and then inserting into

<insert path="/a/b[@name='firstb']" position="after" buffer="copyb"/>

I presume you're expecting the second xmltask invocation to change the buffer contents such that you have:

<b name="secondb"/>


so you end up with:

<b name="firstb"/>
<b name="secondb"/>
 
?
 

It's hanging in the insert (looping repeatedly). Not sure why yet. If you change the second xmltask to write to file thus:

<xmltask sourcebuffer="copyb" report="true" dest="copyb" failWithoutMatch="true">

and then the third to insert from a file thus:

<insert path="/a/b[@name='firstb']" position="after" file="copyb"/>

then your output looks like:

<?xml version="1.0" encoding="UTF-8"?>
<a>
    <b name="firstb"/>
    <b name="secondb"/>
</a>

which I believe is what you want, even if it's not the route you want to take. I only suggest this since I won't get a chance to look at this until tomorrow, but it'll get you going in the meantime (if my assumptions are correct). I'll chase up tomorrow and see what's going on and get back to you! Hopefully with some sort of proper fix.

Brian

Pete Hale wrote:

Brian,

 

I have run into a situation where I am getting an java.lang.OutOfMemoryError. It occurs when I am trying to insert a buffer into a xml file. The out of memeory error is with Sun j2se 1.5 (windows) and xmltask 1.10.7 and on jrockit 1.5 the CPU % goes 100 and the job never fails (cygwin).

 

The attached bufferinsert.xml (build) and sample xml file (base.xml).

 

Any help you can provide will be greatly appreciated.

 

Pete Hale

--------------------------------------------------------------------------------
 
Join CEO Alfred Chuang and CTO Mark Carges on June 15 for a unique online 
event, giving you the first look at a new category of enterprise software 
built specifically for Service-Oriented Architecture (SOA).
 
Register Now.  It's Free!
 
http://www.bea.com/events/june15
  
 



 
<?xml version="1.0" encoding="UTF-8"?>
<a>
    <b name="firstb"/>
</a>
  
 



 
<?xml version="1.0"?>
<project name="bufferInsert" basedir="." default="bufferInsert">
    <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
    <target name="bufferInsert">
       <echo message="****step 1****"/>
        <xmltask source="base.xml" report="true">
            <copy path="/a/b[@name='firstb']" buffer="copyb"/>
        </xmltask>
       <echo message="****step 2****"/>
        <xmltask sourcebuffer="copyb" report="true" failWithoutMatch="true">
            <attr path="/b[@name='firstb']" attr="name" value="secondb"/>
        </xmltask>
       <echo message="****step 3****"/>
        <xmltask preservetype="true" report="true" failWithoutMatch="true"
            source="base.xml"
            dest="base.out.xml">
            <insert path="/a/b[@name='firstb']" position="after" buffer="copyb"/>
        </xmltask>
    </target>
</project>
  



-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian @ oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012
--------------------------------------------------------------------------------

Join CEO Alfred Chuang and CTO Mark Carges on June 15 for a unique online 
event, giving you the first look at a new category of enterprise software 
built specifically for Service-Oriented Architecture (SOA).

Register Now.  It's Free!

http://www.bea.com/events/june15