You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Chad.Chang" <ch...@oracle.com> on 2007/09/11 03:43:42 UTC

how to replace a segment in a XML file?

I have to replace a section in a xml file which can be identified by 
attribute "id".

The section which id equals 100 is what i wanna replace with <xxx 
id="100" name="test">. Could you guys give me some suggestions?

<root>
................
<xxx id="100">
</xxx>
............
<xxx id="200">
</xxx>
................
</root>


Thanks,
-Chad

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: how to replace a segment in a XML file?

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
 

Hi,

-----Original Message-----
From: Chad.Chang [mailto:chad.chang@oracle.com] 
Sent: Tuesday, September 11, 2007 7:42 AM
To: Ant Users List
Subject: Re: how to replace a segment in a XML file?

/*
Thanks for your reply.

I am not allowed to introduce thirdparty libraries even open-source ones

in my project. So I just wanna use regular expression in combination 
with replace/replaceregexp tasks to perform it.
BTW, xmltask works well in my previous testing.

more suggestions?

thanks,
-Chad
*/

Sure a restrictive handling of putting tools into the game
, means one person/group should be responsible for that
and you have to ask them, makes sense.

But Ant is OpenSource itself, why ain't it allowed to use another
excellent task that extends Ant ?!?!?

Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: how to replace a segment in a XML file?

Posted by "Chad.Chang" <ch...@oracle.com>.
Thanks for your reply.

I am not allowed to introduce thirdparty libraries even open-source ones 
in my project. So I just wanna use regular expression in combination 
with replace/replaceregexp tasks to perform it.
BTW, xmltask works well in my previous testing.

more suggestions?

thanks,
-Chad

Vijay Aravamudhan wrote:
> we use the xmltask (http://www.oopsconsultancy.com/software/xmltask/) 
> to work with xml structures within an ant file. And it seems to fit 
> our needs.
> Based on what you want to do, this might help.
>
> NOTE: I am in no way affiliated to/with OOPS consultancy. Just think 
> that this package/tool is a great addition to ant while working with 
> xml structures.
>
> thanks,
> hth,
> Vijay
>
> Chad.Chang wrote:
>> I have to replace a section in a xml file which can be identified by 
>> attribute "id".
>>
>> The section which id equals 100 is what i wanna replace with <xxx 
>> id="100" name="test">. Could you guys give me some suggestions?
>>
>> <root>
>> ................
>> <xxx id="100">
>> </xxx>
>> ............
>> <xxx id="200">
>> </xxx>
>> ................
>> </root>
>>
>>
>> Thanks,
>> -Chad
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: how to replace a segment in a XML file?

Posted by Vijay Aravamudhan <av...@gmail.com>.
we use the xmltask (http://www.oopsconsultancy.com/software/xmltask/) to 
work with xml structures within an ant file. And it seems to fit our needs.
Based on what you want to do, this might help.

NOTE: I am in no way affiliated to/with OOPS consultancy. Just think 
that this package/tool is a great addition to ant while working with xml 
structures.

thanks,
hth,
Vijay

Chad.Chang wrote:
> I have to replace a section in a xml file which can be identified by 
> attribute "id".
>
> The section which id equals 100 is what i wanna replace with <xxx 
> id="100" name="test">. Could you guys give me some suggestions?
>
> <root>
> ................
> <xxx id="100">
> </xxx>
> ............
> <xxx id="200">
> </xxx>
> ................
> </root>
>
>
> Thanks,
> -Chad
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org