RE: [Xmltask-users] batch process with XMLTask
Brought to you by:
bagnew
From: Robert S. <rso...@sa...> - 2004-12-06 14:34:51
|
I just can't get any script with xmltask to run. I allways get an exception: CreateFile: [xmltask] java.lang.NullPointerException [xmltask] at com.oopsconsultancy.xmltask.XmlReplacement.apply(XmlReplacement.java:65) [xmltask] at com.oopsconsultancy.xmltask.ant.XmlTask.processDoc(XmlTask.java:652) [xmltask] at com.oopsconsultancy.xmltask.ant.XmlTask.execute(XmlTask.java:621) [xmltask] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) [xmltask] at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [xmltask] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [xmltask] at java.lang.reflect.Method.invoke(Unknown Source) [xmltask] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:9 5) [xmltask] at org.apache.tools.ant.Task.perform(Task.java:366) [xmltask] at org.apache.tools.ant.Target.execute(Target.java:341) [xmltask] at org.apache.tools.ant.Target.performTasks(Target.java:369) [xmltask] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1243) [xmltask] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleChe ckExecutor.java:37) [xmltask] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:401) [xmltask] at com.oopsconsultancy.xmltask.CallAction.apply(CallAction.java:97) [xmltask] at com.oopsconsultancy.xmltask.XmlReplace.applyNode(XmlReplace.java:67) [xmltask] at com.oopsconsultancy.xmltask.jdk14.XPathAnalyser14.analyse(XPathAnalyser1 4.java:35) [xmltask] at com.oopsconsultancy.xmltask.XmlReplace.apply(XmlReplace.java:50) [xmltask] at com.oopsconsultancy.xmltask.XmlReplacement.apply(XmlReplacement.java:60) [xmltask] at com.oopsconsultancy.xmltask.ant.XmlTask.processDoc(XmlTask.java:652) [xmltask] at com.oopsconsultancy.xmltask.ant.XmlTask.execute(XmlTask.java:621) [xmltask] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) [xmltask] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [xmltask] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [xmltask] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [xmltask] at java.lang.reflect.Method.invoke(Unknown Source) [xmltask] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:9 5) [xmltask] at org.apache.tools.ant.Task.perform(Task.java:366) [xmltask] at org.apache.tools.ant.Target.execute(Target.java:341) [xmltask] at org.apache.tools.ant.Target.performTasks(Target.java:369) [xmltask] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1243) [xmltask] at org.apache.tools.ant.Project.executeTarget(Project.java:1213) [xmltask] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut or.java:36) [xmltask] at org.apache.tools.ant.Project.executeTargets(Project.java:1094) [xmltask] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt Runner.java:377) =20 Ant snippet: ----------- <target name=3D"3_SplitDocuments" depends=3D"2_RemoveUnneededTags"> = =09 <xmltask> =20 <fileset dir=3D"${kiwi_dir}" includes=3D"**/*.xml"/> <call target=3D"CreateFile" path=3D"/kiwi-root/kiwi-contentitem" buffer=3D"citem"/> </xmltask> </target> =09 <target name=3D"CreateFile"> <xmltask dest=3D"${split_dir}\out.xml"> <insert buffer=3D"citem" path=3D"/"/> </xmltask> </target> I am totally lost. Any ideas? Robert -----Original Message----- From: xml...@li... [mailto:xml...@li...] On Behalf Of Brian Agnew Sent: Montag, 6. Dezember 2004 14:22 To: Robert Soesemann Cc: xml...@li... Subject: Re: [Xmltask-users] batch process with XMLTask On re-reading this I think that XmlTask will write out .xml files mirroring the source hierarchy, so you can maintain your structure of xml files as per below. I think (but haven't tested this) that you can set the toDir attribute and set source=3D"**/*.xml" or similar. > Hello, > > I am sure that XMLtask is a perfect tool for my purpose. But I still=20 > struggle with the following task. I have a (deep) folder structure=20 > ${in_dir} with xml files. Each file might hold multiple elements of=20 > type contentitem e.g. the fictious file bar.xml. > > <root> > <contentitem> > ... > </contentitem> > <contentitem> > ... > </contentitem> > <contentitem> > <anchor name=3D"xyz"/> <--- NOT ALL CONTENTITEM HAVE A <anchor> > ... > </contentitem> > </root> > > I need to split this in a way that I get one file per <contentitem>. I > know, I can do this with call and insert. But I need to preserve the=20 > folder structure plus modify the resulting filename based on node=20 > values. > > E.g. the input file: > > \in_dir > \foo > \bar.xml > > Needs to be splitted to > > \out_dir > \foo > \bar1.xml <-- number unnamed fragments > \bar2.xml <-- number unnamed fragments > \bar#xyz.xml <-- use /anchor/@name for name extension > > Can anybody help me to solve this? Thanks in advance! > > Robert > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real=20 > users. Discover which products truly live up to the hype. Start=20 > reading now. http://productguide.itmanagersjournal.com/ > _______________________________________________ > Xmltask-users mailing list Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmltask-users > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.=20 http://productguide.itmanagersjournal.com/ _______________________________________________ Xmltask-users mailing list Xml...@li... https://lists.sourceforge.net/lists/listinfo/xmltask-users |