All elements allowed as children except one ???

This should cover W3C XML Schema, Relax NG and DTD related problems.
jkennedy
Posts: 1
Joined: Tue Sep 26, 2006 8:05 pm

All elements allowed as children except one ???

Post by jkennedy »

Is it possible to define a complex type that can contain any element from the local namespace except for one specified element. I have a schema with about 1500 elements of the same type. I am trying to define another element that can contain any number of the other elements in any order except for one or two specific elements. I cannot find a way to define this is xsd. Thank you for you help. :?:
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

No, you cannot do that in XML Schema.
You can allow all the elements and add a Schematron rule to report an error if one of the elements you do not want to appear is present.
Relax NG schema has an except pattern that does exactly what you want.
oXygen has support for both XML Schema with Schematron embedded rules (and can validate against such a schema) and for Relax NG.

Best Regards,
George
Post Reply