Thanks much, Brian for your prompt response – that was it- I didn’t read the documentation regarding the <taskdef> definition thoroughly enough. Two files = two taskdef

 

Kevin M. Rosso

Contractor - SAIC

Software Engineer

301-402-3888

 


From: Brian Agnew [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 23, 2006 7:57 AM
To: Rosso, Kevin (NIH/NCI) [C]
Cc: xmltask-users@lists.sourceforge.net
Subject: Re: [Xmltask-users] Insert not working

 

You need to copy from one file into another. <xmltask> will transform a source into a destination. So you need something like:

<xmltask source="source_file.xml">  <!-- no destination -->
   <copy....

and then

<xmltask source="dest_file.xml" dest="dest_file.xml">
  <insert...
</xmltask>

So the first <xmltask> reads from one file, and the second pastes into dest_file.xml. Note the comment in the documentation regarding the <taskdef> definition of <xmltask> and classpaths.

Brian

Rosso, Kevin (NIH/NCI) [C] wrote:

I am attempting to copy a section of xml from one file and insert it at a specified position in another file.

Here is my source file example:

                        <application-list>          

                            <application>

                                    <name>

                                                myname                                                                                                                       

                                    <name>                                   

                                    <authorization-provider-class>

                                                My.class.java

                                    </authorization-provider-class>                                       

                           </application>

                        </application-list>

 

Here is my dest file example:

                        <application-list>          

                            <application>

                                    <name>

                                                myOthername                                                                                                               

                                    <name>                                   

                                    <authorization-provider-class>

                                                My.Otherclass.java

                                    </authorization-provider-class>                                       

                           </application>

                        </application-list>

 

The goal is to insert just the <application> section from my source file to my destination file

after the last <application> tag in the dest file but before <application-list> tag.

 

 

The code I am using is as follows:

<xmltask source="source_file.xml" dest=dest_file.xml">

  <copy path="//application" buffer="namedBuffer"/>

  <insert path="//application-list[1]" buffer="namedBuffer"/>

</xmltask>

 

There are 2 problems that occur when I run this:

The values for all the elements are replaced with the values of the buffers elements

The section is inserted the first time with the wrong values as mentioned above.

      Any additional time I run the task, nothing is inserted.

 

Unfortunately, the final file always looks like this:

                        <application-list>          

                            <application>

                                    <name>

                                                myOthername                                                                                                                                       

                                    <name>                                   

                                    <authorization-provider-class>

                                                My.Otherclass.java

                                    </authorization-provider-class>                                       

                           </application>

                           <application>

                                    <name>

                                                myOthername                                                                                                               

                                    <name>                                   

                                    <authorization-provider-class>

                                                My.Otherclass.java

                                    </authorization-provider-class>                                       

                           </application>

                        </application-list>

 

Please Help!!!!!

 

 

           

-Newbie user

 


 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
 



 
_______________________________________________
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
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to