Author Topic: XSD Attribute Group also XSDSimpleType  (Read 5398 times)

pmahoney

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • An old picture. More grey now :-(
    • View Profile
XSD Attribute Group also XSDSimpleType
« on: June 21, 2005, 12:42:10 am »
Dear Team

1. I'm getting to grips with XSD generation and have not been able to fgiure out how to set up an attribute group that can then include in an elements as and when required.

2. Having failed to do this, I thought of creating some <<XSDSimpleType>> clases and then using an <<XSDattribute>> association to include them type as attributes wherever required. This sort of worked but I have not been able to set the type. I want "xs:decimal" but the generated schema always uses "xs:string" as the base of my SimpleType.

Can the team help on either count?

VK

  • EA Administrator
  • EA User
  • *****
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: XSD Attribute Group also XSDSimpleType
« Reply #1 on: June 21, 2005, 05:33:30 pm »
Hello pmahoney,

Elements in a Class can have stereotype <XSDattribute>. An element with this stereotype will be generated as an attribute group.

Lets say that you create a Class, say 'Class1', with stereotype <XSDcomplexType>. Add an element to it, say 'elem1', and set its stereotype to <XSDattribute>. Generate the XSD. The schema will be like :

<xs:element name="Class1" type="Class1"/>
<xs:complexType name="Class1">
           <xs:sequence/>
           <xs:attributeGroup ref="Class1.att"/>
</xs:complexType>

<xs:attributeGroup name="Class1.att">
           <xs:attribute name="elem1" use="optional" type="xs:integer"/>
</xs:attributeGroup>

The advantage of using the stereotype <XSDattribute> on elements is that you can have any desired data-type for the element - not just "xs:string".

Cheers.

pmahoney

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • An old picture. More grey now :-(
    • View Profile
Re: XSD Attribute Group also XSDSimpleType
« Reply #2 on: June 21, 2005, 11:38:48 pm »
Hello vkumer

I understand about <XSDattribute> on an element. It results in an attribute group referenced by the containing class. What I need is a attriubute group that I can reference from a number of classes. I had hoped the using the <XSDattribute> stereotype on a class might give me this.

Cheers, Paul

VK

  • EA Administrator
  • EA User
  • *****
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: XSD Attribute Group also XSDSimpleType
« Reply #3 on: June 22, 2005, 06:25:40 pm »
Hello Paul,

As of now, there is no option to specify the dataType of a <XSDsimpleType> stereotyped class. It always takes the default value of "xs:string".

But, we will change this default behaviour in the future release of EA.

Cheers.

pmahoney

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • An old picture. More grey now :-(
    • View Profile
Re: XSD Attribute Group also XSDSimpleType
« Reply #4 on: June 22, 2005, 10:21:03 pm »
Hello vkumar

That would be great. Any chance the ability to model an attribute group can also be supported? Say, by using an <XSDAttributeGruop> stereotype on a class and using an association to include it hwere required?

Regards, Paul

VK

  • EA Administrator
  • EA User
  • *****
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: XSD Attribute Group also XSDSimpleType
« Reply #5 on: July 03, 2005, 07:11:23 pm »
Hello pmahoney,

The XML Profile is being modified and it will incorporate  many new features, including a new stereotype called <XSDattributeGroup>  :)

These changes will be available during the next major release of EA.

Cheers.