You cannot copy an XML element into a property. If you modify the path to be:
/book/level1/[EMAIL PROTECTED]'...']/text() to get the text node i.e. the text within the <level1> element. Of course that's currently blank. Or if you use: /book/level1/[EMAIL PROTECTED]'...']/@name and provide attrValue="true" to get the value of the @name attribute, then you'll get Mhdk General Help The following should do both: <target name="main"> <xmltask source="flash_help_toc.xml" report="true"> <copy path="/book/[EMAIL PROTECTED]'Mhdk General Help']/text()" property="mhdk.help.element"/> <copy path="/book/[EMAIL PROTECTED]'Mhdk General Help']/@name" attrValue="true" property="mhdk.help.attr"/> </xmltask> <echo message="mhdk.help.element : ${mhdk.help.element}"/> <echo message="mhdk.help.attr : ${mhdk.help.attr}"/> </target> Brian On Wed, June 20, 2007 16:32, Gandon, Sébastien wrote: > I am using the 1.15 (xmltask-v1.15.jar), it seems to be the last according > to the web site. > > -----Message d'origine----- > De : Brian Agnew [mailto:[EMAIL PROTECTED] > Envoyé : mercredi 20 juin 2007 17:23 > À : Gandon, Sébastien > Cc : xmltask-users@lists.sourceforge.net > Objet : RE: [Xmltask-users] Can get <copy> to work with property attribute > > Which version of xmltask are you using ? > > On Wed, June 20, 2007 16:08, Gandon, Sébastien wrote: >> I do not get this error message. >> I have tried with the attrValue="true" and this does no work either, the >> property mhdk.help.element is still not set. >> >> Actually what I am trying to do is to set a property (with any value) if >> a >> node exists, that is why I use the copy task. >> >> Any other idea? >> >> SeB. >> >> -----Message d'origine----- >> De : Brian Agnew [mailto:[EMAIL PROTECTED] >> Envoyé : mercredi 20 juin 2007 17:01 >> À : Gandon, Sébastien >> Cc : xmltask-users@lists.sourceforge.net >> Objet : Re: [Xmltask-users] Can get <copy> to work with property >> attribute >> >> Do you get the message: >> >> "Can only cut/copy text() nodes and attribute values to properties" ? >> >> You can only do this since you can't store an XML structure in a >> property. >> I suspect you just want the name attribute value, in which case you can >> copy and provide attrValue="true" to grab the attribute value. >> >> Does that sound correct ? >> >> Brian >> >> On Wed, June 20, 2007 15:51, Gandon, Sébastien wrote: >>> Hello, >>> >>> >>> >>> Here is a test case where the copy task does not set the property value >>> with the xml element copied. >>> >>> This can be checked by replacing "property" attribute with the >>> "buffer", >>> to see that the copy get done in the buffer but not in the property. >>> >>> >>> >>> Am I doing something wrong? >>> >>> >>> >>> Thanks for any lead. >>> >>> >>> >>> SeB. >>> >>> >>> >>> --------------------------- Ant target >>> ----------------------------------- >>> >>> >>> >>> >>> >>> <target name="test xml copy"> >>> >>> <xmltask source="flash_help_toc.xml" report="true"> >>> >>> <copy path="book/[EMAIL PROTECTED]'Mhdk General Help']" >>> property="mhdk.help.element"/> >>> >>> <print comment="copied buffer is :" >>> buffer="mhdk.help.element"/> >>> >>> </xmltask> >>> >>> <echo message="mhdk.help.element : ${mhdk.help.element}"/> >>> >>> </target> >>> >>> >>> >>> --------------------------- end of Ant target >>> ----------------------------------- >>> >>> >>> >>> --------------------------- test file called flash_help_toc.xml >>> ----------------------------------- >>> >>> >>> >>> <?xml version="1.0" encoding="UTF-8"?> >>> >>> <book title="MHDK help" directory="MHDK Help" >>> categories="languagereferences,as2" language="en" version="2.0" >>> sort="mm_5"> >>> >>> <level1 href="D:\Program Files\NDS >>> Technologies\MHDK\Doc\index.html" >>> name="other Help"/> >>> >>> <level1 href="D:\Program Files\NDS >>> Technologies\MHDK\Doc\index.html" >>> name="Mhdk General Help"/> >>> >>> </book> >>> >>> >>> >>> --------------------------- end of test file >>> ----------------------------------- >>> >>> >>> >>> *********************************************************************************** >>> This e-mail is confidential, the property of NDS Ltd and intended for >>> the >>> addressee only. Any dissemination, copying or distribution of this >>> message or any attachments by anyone other than the intended recipient >>> is >>> strictly prohibited. If you have received this message in error, >>> please >>> immediately notify the [EMAIL PROTECTED] and destroy the original >>> message. Messages sent to and from NDS may be monitored. NDS cannot >>> guarantee any message delivery method is secure or error-free. >>> Information could be intercepted, corrupted, lost, destroyed, arrive >>> late >>> or incomplete, or contain viruses. We do not accept responsibility for >>> any errors or omissions in this message and/or attachment that arise as >>> a >>> result of transmission. You should carry out your own virus checks >>> before >>> opening any attachment. Any views or opinions presented are solely >>> those >>> of the author and do not necessarily represent those of NDS. >>> >>> To protect the environment please do not print this e-mail unless >>> necessary. >>> *********************************************************************************** >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by DB2 Express >>> Download DB2 Express C - the FREE version of DB2 express and take >>> control of your XML. No limits. Just data. Click to get it now. >>> http://sourceforge.net/powerbar/db2/_______________________________________________ >>> 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 e-mail is confidential, the pro ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Xmltask-users mailing list Xmltask-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xmltask-users