Well, what you are missing is the fact that 
athlete.schemaType().getAnnnotation() is getting the <annotation> on the 
"data:athlete" type, not the "athlete" element (The type can just as well have 
its own annotation).
 
Now, what you are probably wondering is how to get to the element associated 
with your XmlObject. But the thing is that XmlObjects are instances of types, 
not of elements. The only way to get the element is to get the element's name 
(via athlete.newCursor().getName()), then get the parent's type content model 
(athleteParent.schemaType().getContentModel()) and then traverse the content 
model. I know it looks more complicated than necessary, but because you can 
have multiple elements with different names but the same type, as well as 
multiple elements with the same name but different annotations, all in the same 
"parent" type , it is necessary to have a bit of logic to specify which element 
exactly you are looking for.
 
Radu


________________________________

        From: Eric Murphy [mailto:[EMAIL PROTECTED] 
        Sent: Friday, September 26, 2008 10:34 PM
        To: [email protected]
        Subject: Getting Annotations
        
        

        I expect to find an annotation for my athlete element but the value is 
"null". Here is the element declaration:

         

        <element name="athlete" type="data:athlete" maxOccurs="unbounded" 
minOccurs="1">

          <annotation>

            <documentation>

              An athlete must have a valid person description and a sport list 
containing at least one sport.

            </documentation>

          </annotation>

        </element>

         

        Here is my code to get the annotation:

         

        SchemaAnnotation annotation = athlete.schemaType().getAnnotation();

         

        Seems simple enough. What am I missing?

         

        Thanks

        Eric

Reply via email to