You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Simon Baker <si...@clearmoney.com> on 2002/08/22 18:09:20 UTC

Read repetitive tags as properties from an XML file

Problem:
Retrieve a number of properties from a given XML file.
Some tags are repeated in the XML file, for instance:
<b>
  <a> one </a>
  <a> two </a>
  <a> three </a>
</b>
The property 'b.a' in ant should be set to 'one,two,three'

Known solutions:
1. With xsl I have managed to convert the xml file to property file and then
simple load the property file. This is not ideal.
2. Use XMLProperty, I however could not get it to handle repetitive tags as
in the above example.
3. Write my own ant command, to retrieve repetitive tags.

Any better ideas?


**********************************************************************
Confidentiality: this e-mail and any attachments may be confidential. If you are not the intended recipient you should not read, copy, distribute, disclose or otherwise use the information in this e-mail and any attachments. Please reply to this e-mail highlighting the error and delete the e-mail and any attachments from your system.

Security Warning: please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. We suggest that you consider this when e-mailing us.

Viruses: although we have taken steps to ensure that this e-mail and attachments are free from any virus we advise that in keeping with good computing practice the recipients should ensure that they are actually virus free.

Clear, Clear Money and the Clear logo are trade marks of Clear Money Limited and they should not be used, nor should any part of the material in this e-mail be copied, without our prior written permission. Clear Money Limited is a limited liability company incorporated in the UK. Registered Office: 84-86 Regent Street, London. W1B 5RR. Telephone: 020 7025 6500. Fax: 020 7025 6501. Corporation No: 03873527. VAT No: 751 8550 22.
**********************************************************************

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Read repetitive tags as properties from an XML file

Posted by Nicola Ken Barozzi <ni...@apache.org>.

Simon Baker wrote:
> Problem:
> Retrieve a number of properties from a given XML file.
> Some tags are repeated in the XML file, for instance:
> <b>
>   <a> one </a>
>   <a> two </a>
>   <a> three </a>
> </b>
> The property 'b.a' in ant should be set to 'one,two,three'
> 
> Known solutions:
> 1. With xsl I have managed to convert the xml file to property file and then
> simple load the property file. This is not ideal.
> 2. Use XMLProperty, I however could not get it to handle repetitive tags as
> in the above example.
> 3. Write my own ant command, to retrieve repetitive tags.
> 
> Any better ideas?

Added a patch to do as you ask :-)

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12045

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>