« Return to Thread: Possible to restrict top-level xs:element names?

Possible to restrict top-level xs:element names?

by kennardconsulting :: Rate this Message:

| View in Thread

Hi guys,

I'm generating a bunch of XML Schemas that look roughly like:

<xs:schema ...>
   <xs:element name="foo"/>
   <xs:element name="bar"/>
</xs:schema>

You can see the actual ones here. My question is, this schema allows me to declare 'foo' and 'bar' in my XML document, but doesn't restrict me declaring, say, 'baz'. I was expecting something like...

<xs:schema final="#all">

...so that I could 'close' the set of possible xs:element names. Or maybe that the set was closed by default and I'd need...

<xs:schema ...>
   <xs:element name="foo"/>
   <xs:element name="bar"/>
   <xs:any />
</xs:schema>

...to make it open. But instead the set of top-level xs:element names appears 'open' by default and I can't find a way to close it? I have looked all over the specs and in this forum, sorry if I'm being dumb.

Regards,

Richard.

 « Return to Thread: Possible to restrict top-level xs:element names?