users@jaxb.java.net

Re: java.util.Properties

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 18 Sep 2006 08:22:17 -0700

You suggested that this <properties>/<property>/<name>/<key> element
names are well-established convention, but I'm not sure. For one thing,
what's the namespace URI? I don't think there's a single
well-established XML infoset representation for any Map.

That said, java.util.Properties is a Map, and JAXB can conceivably
improve the handling of Map. Today, it doesn't let you change the tag
names of <key> nor <value>.

But even with that kind of change, it would be still difficult for XJC
to generate a Map, because schema doesn't really tell it if this
<properties> element has a map semantics. That kind of inference is very
hard to do, especially with languages like W3C XML Schema.


Dale Wyttenbach wrote:
>>Sorry, I could not understand the requirement - could you please
> elaborate a bit?
>
> If you've got XML that looks like this:
>
> <properties>
> <property>
> <name>color</name>
> <value>red</value>
> </property>
> <property>
> <name>flavor</name>
> <value>cherry</value>
> </property>
> </properties>
>
> Given the appropriate schema, xjc generates code like this:
>
> public PropertiesType getProperties() {
> return properties;
> }
>
>
> Is it possible to generate this instead:
>
> public java.util.Properties getProperties() {
> return properties;
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com