users@jaxb.java.net

Re: XSComplexType

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 15 Nov 2006 18:13:48 -0800

HeruMartinus.Salim_at_infineon.com wrote:
> Hello,
>
> Any idea how to get the defined attribute (sequence/option) inside the complexType using class XSComplexType?

Javadoc is at https://xsom.dev.java.net/nonav/javadoc/index.html

Also look at
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/components.gif for
the object model.


> <xsd:complexType name="Block">
> <xsd:complexContent>
> <xsd:extension base="essence:SingleSourceNode">
> <xsd:sequence>
> <xsd:element maxOccurs="unbounded" minOccurs="0" name="varDef" type="essence:VarDef"/>
> </xsd:sequence>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> My "Guess" is to use the method getExplicitContent() which return an object of interface XSContentType. (At least that's what I get from the explanation of this method).

Yep. XSContentType is a super interface. You'd downcast that to one of
the three. In your case you should see a XSParticle, and then XSParticle
should contain an XSTerm which is actually XSModelGroup, and that's the
sequence.

> But when I go inside Javadoc of XSContentType there are only these methods exist, inbetween none represent what I'm looking for. (I'm going to get the types of those sequence/option):
> apply <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/XSContentType.html#apply%28com.sun.xml.xsom.visitor.XSContentTypeFunction%29> (XSContentTypeFunction <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/visitor/XSContentTypeFunction.html> <T> function)
>
> XSContentType <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/XSContentType.html> asEmpty <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/XSContentType.html#asEmpty%28%29> ()
> If this content type represents the empty content, return this, otherwise null.
> XSParticle <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/XSParticle.html> asParticle <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/XSContentType.html#asParticle%28%29> ()
> Equivalent of (this instanceof XSParticle)?this:null
> XSSimpleType <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/XSSimpleType.html> asSimpleType <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/XSContentType.html#asSimpleType%28%29> ()
> Equivalent of (this instanceof XSSimpleType)?this:null
> void visit <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/XSContentType.html#visit%28com.sun.xml.xsom.visitor.XSContentTypeVisitor%29> (XSContentTypeVisitor <https://xsom.dev.java.net/nonav/javadoc/com/sun/xml/xsom/visitor/XSContentTypeVisitor.html> visitor)
>
> Any guidance?
> Thanks
> Best regards,
> Heru
>
> ---------------------------------------------------------------------
> 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