"David Rolland" <[EMAIL PROTECTED]> wrote on 03/17/2004
04:29:27 AM:

> I'm trying to retrieve attributes declarations from an 'XSModel' instance
> using 'getAttributeDeclaration' method but null is return.
> For example, I can't get 'birthday' and 'adn' declarations.

The XSModel interface is for accessing the top-level items in the schema.
The attribute declarations you are trying to get at are local. To get at
the 'birthday' and 'adn' declarations, you would have retrieve them from
the attribute uses of the complex type definition of the 'dog' element
declaration, eg:

XSElementDeclaration dogDecl = schemaModel.getElementDeclaration("dog",
null);
XSComplexTypeDefinition complexType =
(XSComplexTypeDefinition)dogDecl.getTypeDefinition();
XSObjectList attributeUses = complexType.getAttributeUses();
for(int i = 0; i < attributeUses.getLength(); i++) {
      XSAttributeUse attrUse = (XSAttributeUse)attributeUses.item(i);
      XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration();
      //Work with attrDecl
      ...
}

Hope this helps you!

Mike Boos
[EMAIL PROTECTED]
(905) 413-3722


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to