Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Limits on restriction of complex types?

 
Henry Zheng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Richard mentioned in the book, there are certain limits on restriction of complex types:

You cannot omit an element from a restriction unless the parent type declared it to be optional(minOccurs="0"). In addition, the derived type's occurrence constraints cannot be less strict than those of its base type. For example, you cannot constrain an element to minOccurs="0" and maxOccurs="4" in the child if the parent's element is defined as minOccurs="1" and maxOccurs="2". The restricted occurrence attributes must fall within the boundaries defined by the parent type.

But when I omitted an element which was not optional, or specified a boundary which is out of the original one specified in the base type, no error was reported and the schema was considered as valid.
By the way, I use XMLSPY 2004 enterprise edition. So anyone can shed some light?
 
Richard Monson-Haefel
author
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry, can you send me your XML code. I want to test it. All the XML was tested in XMLSpy so our results should be consistent. You can send it to my address at Richard@Monson-Haaefel.com.
thanks,
Richard
 
Henry Zheng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Richard,
I've send you my schema and xml files.
 
Lipman Li
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry, Richard,
what's the conclusion then?
thanks
 
Henry Zheng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lipman,

Richard and his book was right

He suggested me to run the test under Xerce.

and under Xerce version 2.6.2, my snippet got following error:


Also according to the specs, it should be one of XMLSpy's bugs.

So be aware, ranchers
 
Lipman Li
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank Henry.

Looks like Spy sometimes has mistakes more easily.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic