users@jaxb.java.net

Re: java.util.Properties

From: Dale Wyttenbach <wytten_at_yahoo.com>
Date: Mon, 18 Sep 2006 14:00:10 -0500

Thanks for the reply. I didn't mean to imply the existence of a
well-established convention, what I mean to say was "if such a
convention existed, would it be within the philosophy of JAXB..."

It would be pretty slick I think if something like this could be done.
 But as you said, you're limited by XML schema syntax.

On 9/18/06, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
>
> 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
>
>
>