commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet" <guillaume.no...@deliasystems.com>
Subject RE: [Configuration] Problems with properties containing integers in the name
Date Thu, 12 Feb 2004 12:55:28 GMT
An xml tag ('Name') must begin with a letter:

NameChar ::=  Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar |
Extender
Name ::=  (Letter | '_' | ':') (NameChar)*

I have read in some book a normalized form of such properties in xml:

 	xxx.yyy.1=zzz1
 	xxx.yyy.2=zzz2

becomes

	<xxx>
		<yyy>zzz1</yyy>
		<yyy>zzz2</yyy>
	</xxx>

Or for my purpose, i imagine

	xxx.yyy.1.ttt = zzz1
	xxx.yyy.1.uuu = zzz2
	xxx.yyy.2.ttt = zzz3
	xxx.yyy.2.uuu = zzz4

becomes

	<xxx>
		<yyy>
			<ttt>zzz1</ttt>
			<uuu>zzz2</uuu>
		</yyy>
		<yyy>
			<ttt>zzz3</ttt>
			<uuu>zzz4</uuu>
		</yyy>
	</xxx>


For the subset problems, i've no time now to write a full junit test,
but here is a hint:

	config.setProperty("a.b.c", "x");
	config.setProperty("a.bc.d", "y");

	config.subset("a.b");

The subset should contains only the "a.b.c" property (renamed to "c"), but
it seems to contains
also the "a.bc.d" property, which is renamed to ".d".

Regards,

Guillaume


-----Message d'origine-----
De : Eric Pugh [mailto:epugh@upstate.com]
Envoyé : jeudi 12 février 2004 12:19
À : 'Jakarta Commons Users List'
Objet : RE: [Configuration] Problems with properties containing integers
in the name


Hi..

Could you file a bug for this?  A failing unit test would be even better.
As far as the XML, are you saying that in xml, this is a valid tag: <myTag>
but this is not: <1myTag> or <1>?

Odd, but if that is true, we should document that short coming.  In terms of
fixing it, I don't think their is anything to do...

As far as your subset problem, could you submit a test case?  Not quite sure
I understand what the problem is...

Eric

> -----Original Message-----
> From: Guillaume Nodet [mailto:guillaume.nodet@deliasystems.com]
> Sent: Wednesday, February 11, 2004 2:28 PM
> To: commons-user@jakarta.apache.org
> Subject: [Configuration] Problems with properties containing
> integers in
> the name
>
>
> I've tried to use the configuration component but ran into
> the following
> problems.
> I wanted to export a configuration (stored in a .properties
> file) to an xml.
> The problem is that i had some properties like this:
> 	xxx.yyy.1=zzz1
> 	xxx.yyy.2=zzz2
> 	...
>
> Two problems arose:
>  * the xml syntax does not support tag beginning by a numeric
> character,
>    so the <1>, <2> tags are not valid
>  * my list of properties contained more than 10 items and the
> subset method
>    returned bad things. The subset method does not check for
> a '.' at the
>    end of the prefix, so that xxx.yyy.10.zzz was returned
> when asking for a
> subset
>    beginning with 'xxx.yyy.1'.
>
> Regards,
>
> Guillaume Nodet
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


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





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


Mime
View raw message