users@jaxb.java.net

Re: how to use xsom to detect the presence of xsd:choice

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 13 Mar 2007 09:43:06 -0700

Art wrote:
> In general:
>
> Is there any reference for xsom besides the javadoc?

Err, source code? :-(

> On particular:
>
> When using xsom and XSComplexType how do I determine the content?
>
> According to the w3c the content of a ComplexType can be:
>
> /Content: /(annotation
> <http://www.w3.org/TR/xmlschema-1/#element-annotation>?, (simpleContent
> <http://www.w3.org/TR/xmlschema-1/#element-simpleContent> |
> complexContent
> <http://www.w3.org/TR/xmlschema-1/#element-complexContent> | ((group
> <http://www.w3.org/TR/xmlschema-1/#element-group> | all
> <http://www.w3.org/TR/xmlschema-1/#element-all> | choice
> <http://www.w3.org/TR/xmlschema-1/#element-choice> | sequence
> <http://www.w3.org/TR/xmlschema-1/#element-sequence>)?, ((attribute
> <http://www.w3.org/TR/xmlschema-1/#element-attribute> | attributeGroup
> <http://www.w3.org/TR/xmlschema-1/#element-attributeGroup>)*,
> anyAttribute <http://www.w3.org/TR/xmlschema-1/#element-anyAttribute>?))))
>
> so for
>
> <xsd:complexType name="test">
> <xsd:choice>
> <xsd:element name="one" type="tns:one-type"/>
> <xsd:element name="two" type="tns:two-type"/>
> </xsd:choice>
> </xsd:complexType>
>
> How do I tell with xsom that the elements are wrapped in a xsd:choice?
>
> XSComplexType* getContentType*() returns XSParticle and I don't see how
> to determine the presence of the xsd:choice.

choice is a model group. In XSOM, XSParticle has XSTerm, and
XSModelGroup is a XSTerm. And from XSModelGroup you can find out the
kind of model group.

Take a look at SchemaWriter in XSOM.

>
>
>
>
> ---------------------------------------------------------------------
> 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