ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: AW: XmlProperty - can I specify the property value delimiter?
Date Wed, 24 Oct 2007 07:08:03 GMT
I could also add a delimiter attribute ... but I think you cant wait for 
a next Ant release. So the only thing would be building for yourself ...

BTW: sources are directly viewable on
http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
;)


Right. There are some private methods and subclassing isnt an option and duplicating seems
to be the "easiest" way.
Without any checks ...

1. add the delimiter attribute
   private String delimiter = ",";   // default for backwards compatibility
   getter + setter

2. change method    private void addProperty (String name, String value, String id)
   if (addedAttributes.containsKey(name)) {
       ...
       - value = (String) addedAttributes.get(name) + "," + value;
       + value = (String) addedAttributes.get(name) + getDelimiter() + value;

3. Save under another name "mytasks.XmlProperty.java"

4. Compile

5. Use with 
   <taskdef name="myxmlproperty" classname="mytasks.XmlProperty" classpath="..."/>
   <myxmlproperty delimiter=";" ... />

 

What is the usecase for having an alternative delimiter?


Jan



>-----Urspr√ľngliche Nachricht-----
>Von: J MacKay [mailto:jm.junkmail@yahoo.com] 
>Gesendet: Mittwoch, 24. Oktober 2007 02:20
>An: Ant Users List
>Betreff: Re: AW: XmlProperty - can I specify the property 
>value delimiter?
>
>I went to subclass XMLProperty but forgot that addProperty() 
>and several related methods/variables are private.  Am I right 
>in thinking the only way around this is to essentially 
>duplicate much of the XMLProperty class in my subclass?
>
>An online view of XMLProperty.java can be found here 
>http://www.koders.com/java/fidF328BC3C0E7BEBEA6F1F541ED15778F89
>20CAA14.aspx
>
>Janet
>
>J MacKay <jm.junkmail@yahoo.com> wrote:I decided to go with 
>subclassing XmlProperty ...
>
>
>--
> __________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>

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


Mime
View raw message