Book a Demo

Author Topic: XML Schema Generation specifying restriction base  (Read 3973 times)

saschwarz

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
XML Schema Generation specifying restriction base
« on: June 02, 2003, 08:56:11 am »
Hi
I have a class (with no attributes) of stereotype XSDsimpleType for which I've "Set Element Parent" as nonNegativeInteger. My goal is to have the generated schema look like:

<xs:simpleType name="Rotation">
<xs:restriction base="xs:nonNegativeInteger/>
</xs:simpleType>

Instead the generated XML Schema defaults the restriction base to xs:string (the generation process complains):
Adding class attributes...
   Warning: attribute type was not set. Default is xs:string
...done

Which is what I'd expect since this class won't have any attributes since it is declaring a restriction of an existing type (not defined w/in my class diagram).

Any ideas?

Thanks
Steve

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: XML Schema Generation specifying restriction b
« Reply #1 on: June 02, 2003, 03:32:28 pm »
Hi Steve,

I managed to get the schema generator to produce the output your after, but was unable to replicate the warning message you mentioned.

(I was using Build 611 on XP)
steps:
1. Drag the XSDsimpleType from the project explorer onto the diagram (holding down control key)
2. Set class name to rotation
3. Set Element Parent, using nonNegativeInteger from the XSDDataTypes package.
4. Generate.

I also tried it after manually setting the stereotype on a normal class element, which seemed to work ...  If you can supply any more details,  such as the build/platform or other steps I may have missed in reproducing the warning that would be great.

In the meantime I hope the above steps work for you.

Regards,

Ben

saschwarz

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: XML Schema Generation specifying restriction b
« Reply #2 on: June 02, 2003, 08:07:28 pm »
Ben
Thanks for looking into this. This was my bad...  :'(
I hadn't imported the XSDDataTypes into the model. So when I was specifying nonNegativeInteger the generator was "wumping up" the  required type for me - defaulting to string.

It is funny though I only got the error sometimes on generation(!)

To fix my problem I:
1. Imported XSDDatatypes into the model
2. Deleted my existing Rotation class
3. Followed your steps
4. Generated.

I also didn't know about the ctrl-drag from the project explorer; I was always using the dialog box; that's a good tip.

All is now good.
Thanks
Steve