If you have a SchemaProperty of interest, then yes. See also one of my recent posts:
http://www.mail-archive.com/user%40xmlbeans.apache.org/msg02288.html This talks about retrieving Identity Constraints, but it's the exact same idea. I will write up a FAQ entry on this subject, explaining the difference between SchemaProperty and SchemaParticle and how to navigate SchemaParticles, because it has come up a lot recently. Radu On Thu, 2007-05-24 at 14:06 -0400, Ajay Aggarwal wrote: > Cool. So I get the type's SchemaParticle's children SchemaParticles. And > then walk the children to find the one that matches (by comparing > QNames) with my SchemaProperty of interest. > > Something like this > SchemaAnnotation getAnnotations(SchemaType schemaType, SchemaProperty > prop) { > SchemaParticle typeParticle = schemaType.getContentModel(); > If (typeParticle == null) > Return null; > SchemaParticle[] childParts = > typeParticle.getParticleChildren(); > if (childParts == null) { > return null; > } > for (SchemaParticle part: childParts) { > /* I know my property is of element type */ > if (part.getParticleType() == SchemaParticle.ELEMENT) { > if (part.getName().equals(prop.getName())) { > return ((SchemaLocalElement) > part).getAnnotation(); > } > } > } > } > > > -----Original Message----- > From: Radu Preotiuc-Pietro [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 24, 2007 1:14 PM > To: [email protected] > Subject: RE: How to get annotation from a SchemaProperty instance > > Instead of SchemaProperty, you need to get the content model, via > type.getContentModel(). This way you can get a SchemaParticle and then a > SchemaLocalElement, which you can get the annotation from. > SchemaParticle is not suitable for getting the annotation from it > directly. > > Radu > > -----Original Message----- > From: Ajay Aggarwal [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 24, 2007 8:52 AM > To: [email protected] > Subject: RE: How to get annotation from a SchemaProperty instance > > But that gives annotation for its type. What about the annotation > directly under it? Or for simple properties such as > > <xsd:element name="udpMappingTimeout" minOccurs="0" type="uint32"> > <xsd:annotation> > <xsd:documentation xml:lang="en-US">Specifies how many seconds > of > inactivity before a UDP NAT mapping is timed out > </xsd:documentation> > </xsd:annotation> > </xsd:element> > > Thanks.. > -----Original Message----- > From: Vance Vagell [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 24, 2007 11:35 AM > To: [email protected] > Subject: RE: How to get annotation from a SchemaProperty instance > > Hi Ajay, > > You can get the SchemaType of a SchemaProperty by calling getType() on > it. Hope that helps. > > - Vance > > > -------- Original Message -------- > > Subject: How to get annotation from a SchemaProperty instance > > From: "Ajay Aggarwal" <[EMAIL PROTECTED]> > > Date: Thu, May 24, 2007 11:26 am > > To: <[email protected]> > > > > I can get the SchemaAnnotation from a SchemaType. But how do I get the > > > same from its individual element SchemaProperties? > > > > > > > > Thanks. > > > > > > > > -Ajay > > --------------------------------------------------------------------- > 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] > > > Notice: This email message, together with any attachments, may contain > information of BEA Systems, Inc., its subsidiaries and affiliated > entities, that may be confidential, proprietary, copyrighted and/or > legally privileged, and is intended solely for the use of the individual > or entity named in this message. If you are not the intended recipient, > and have received this message in error, please immediately return this > by email and then delete it. > > --------------------------------------------------------------------- > 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] > Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

