users@jaxb.java.net

Re: element substitution

From: Malachi de AElfweald <malachi_at_eoti.org>
Date: Fri, 21 May 2004 14:36:40 -0700

I've come up with another problem that I think might be related....

My old code created a JAXBContext with multiple namespaces. I also used
the Namespace Prefixer...

Now, a common pattern was a "paramConfig" that contained a 'name' attribute
and a value...
So, I moved that common pattern into its own XSD and used the
abstract="true" on a root element named 'param'

I had 3 other XSDs that I changed from 'name="param" type="paramConfig"' to
'ref="param"'
XJC compiles them fine, docs produced fine... BUT...

when I try to create a JAXBContext including all of them now, I get root
element collisions for the 'param' element...

Just to make sure, I switched the 'ref' back to 'name/type' and it works fine.

Thoughts?

Thanks,
Malachi

At 12:23 PM 5/17/2004, Kohsuke Kawaguchi wrote:

> > The autogenerated API says that the valid values are option, value,
> toggle,
> > flag, and optionConfig
> > Now, although I would like "option" no not be on the list, the one I am
> > concerned about is optionConfig. Why is the abstract element's type listed
> > as a valid child -- the other 3 types are not....
>
>I think here's what's happening:
>
>The internal binding model usually works with somewhat relaxed content
>model. For example, it doesn't check for abstract elements. The reason
>for this is that (1) the generated code/compiler will become simpler and
>(2) it allows more invalid documents to be unmarshalled.
>
>The validator, OTOH, enforces all the constraints, including the
>abstract element checks.
>
>The javadoc is generated from the internal binding model, and therefore
>it didn't take the abstractness of elements into account.
>
>I agree that it's confusing, so I'll change it so that the binding model
>would properly reflect abstract elements.
>
>
>regards,
>--
>Kohsuke Kawaguchi
>Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net