Hello,
        I think u need the following:

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="main" >
      <taskdef name="xmltask"
classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>

            <target name="main" description="Prefix">
                  <xmltask source="application.xml" >
                        <copy path="/:application/:module/@id"
attrvalue="true" property="id_value"/>
                  </xmltask>

                <echo message="ID: ${id_value}" />

                <xmltask source="application.xml"
dest="application.xml">
                      <attr path="/:application/:module" attr="id"
value="Validation_${id_value}"/>
                </xmltask>
            </target>

</project>

Maybe this can be optimalized to use only one xmltask....

With kind regards, Gabriel. 

-----Original Message-----
From: Patrick Luebbecke [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 22, 2008 2:32 PM
To: xmltask-users@lists.sourceforge.net
Subject: [Xmltask-users] Finding xml tags and adding prefixes to
itsattributes


Hi all,

i'm currently trying to modify a set of xml files to with xmltask but
i'm
not sure if i'm using the right syntax.

i'd like to find every <display-name> </display-name> tag in a every
file
of a directory and all subdirectories. thats what my ant script looks
like
so far:

      <taskdef name="xmltask"
classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
            <target name="ApplicationXML" description="Prefix">
                  <xmltask source="temp/META-INF/application.xml">
                        <insert path="application/module"
xml="Validation_"/>


                  </xmltask>
            </target>
</project>>

as you can see i'd like to add a prefix in front of the value of the
<display-name>'s attribute. but when i'm starting the buildprocess i get
the following console output:

C:\APACHE~1.1\anttest>ant
Buildfile: build.xml

ApplicationXML:

BUILD SUCCESSFUL.
Total time: 0 seconds>

the build process finishes but there are no changes in my xml file.

the file looks as follow:

<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="1.4"
xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd";>
      <display-name>blabla</display-name>
      <module id="Module_123456">
            <web>
                  <web-uri>blablabla.war</web-uri>>
                  <context-root>blabla</context-root>
            </web>
      </module>

in that specific case i'd like to set a prefix called Validation_ in
front
of the application/module id attribute like this: <module
id="Validation_Module_123456">

i hope someone can help me to sort this problem out.

regards

Patrick



------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to