It doesn't look like your traversal code walks to the complex type definition with that annotation. It's global so you can easily get to it from the XSModel.
XSModel model = ...; ... XSNamedMap map = model.getComponents(XSTypeDefinition.COMPLEX_TYPE); ... Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Jing Yang" <[EMAIL PROTECTED]> wrote on 03/29/2007 03:44:38 PM: > Use schema API to query annotation. But failed to obtain it in the > case B(see below, search keyword case B): > How to get the annotation in the case B? > > Enclosed the test program and testc.xsd. > > The working environment is java 6 and xerces-j-9 > > > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema xmlns="urn:2008" xmlns:s="urn:set" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > targetNamespace="urn:2008" elementFormDefault="unqualified" > attributeFormDefault="unqualified" xml:lang="en-US"> > <xsd:element name="Message"> > <xsd:complexType> > <xsd:annotation> > <xsd:appinfo>case A</xsd:appinfo> > </xsd:annotation> > <xsd:sequence> > <xsd:element name="Information"> > <xsd:complexType> > <xsd:annotation> > <xsd:appinfo>case A-B</xsd:appinfo> > </xsd:annotation> > > <xsd:complexContent> > <xsd:extension base="InformationType"> > </xsd:extension> > </xsd:complexContent> > </xsd:complexType> > </xsd:element> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:complexType name="InformationType"> > <xsd:annotation> > <!-- case B , problem ? --> > <xsd:appinfo>case B</xsd:appinfo> > </xsd:annotation> > <xsd:complexContent> > <xsd:extension base="SetBase"> > <xsd:sequence> > <xsd:element name="Classification"> > <xsd:complexType> > <xsd:annotation><xsd:appinfo>case C </xsd: > appinfo> </xsd:annotation> > <xsd:simpleContent> > <xsd:extension base="xsd:string"> > <xsd:annotation> > <xsd:appinfo>case D </xsd:appinfo> > </xsd:annotation> > <xsd:attribute name="a" type="xsd:string"/> > </xsd:extension> > > </xsd:simpleContent> > </xsd:complexType> > </xsd:element> > </xsd:sequence> > </xsd:extension> > </xsd:complexContent> > </xsd:complexType> > <xsd:complexType name="SetBase"> > <xsd:sequence> > <xsd:element name="AAAA" type="xsd:string"/> > </xsd:sequence> > > </xsd:complexType> > </xsd:schema> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]