ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiji <>
Subject help with filterchain: using regex filter...
Date Tue, 11 Aug 2009 06:48:01 GMT


I'm trying to use Ant to convert an XML file from one format to another.  We
are using it this way in order to generate Flex manifest files for
compilation using the flex command-line compiler.  Basically we have a list
of classes to compile, but they're in one format and the manifest file is in
a slightly different format.  I'm able to do most of the conversion using
filterchains, but I'm stuck on the last portion and I'm hoping someone here
can help me out.

The input file structure looks like this:


<?xml version="1.0" encoding="UTF-8"?>
<flexLibProperties version="1">
    <classEntry path=""/>
    <classEntry path=""/>
    <classEntry path=""/>
(more classes here)

The manifest.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
    <component id="ClassA" class=""/>
    <component id="ClassB" class=""/>
    <component id="ClassC" class=""/>
(more classes here)

So far I have the following:

    <target name="testman" description="Convert a .flexLibProperties file
into a manifest file">
        <property name="tempfile" value="manifest.temp"/>
        <property name="outfile"  value="manifest.xml"/>
        <property name="flag.keepme" value="keepme"/>

        <delete file="${tempfile}"/>
        <delete file="${outfile}"/>
        <copy file=".flexLibProperties" tofile="${tempfile}">
                <replacestring from="xml version" to="xml ${flag.keepme}
                <replacestring from="includeClasses" to="componentPackage
                <replacestring from="classEntry" to="component"/>
                <replacestring from="path=" to="${flag.keepme} id= class="/>
        <copy file="${tempfile}" tofile="${outfile}">
                    <contains value="${flag.keepme}"/>
                <replacestring from=" ${flag.keepme}" to=""/>

This gets me pretty close; the output looks like this:

<?xml version="1.0" encoding="UTF-8"?>
    <component id= class=""/>
    <component id= class=""/>
    <component id= class=""/>
(more classes here)

The only thing left is to get the class name inserted as the value of the id
attribute.  I can't figure out how to use the regex filters, or if that's
the correct one I should be using. Can anyone lend a hand?

View this message in context:
Sent from the Ant - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message