RE: Are two schemas different content models?

Daniel Dui wrote:

> I have two schemas (schema1 and schema2) and one namespace 
> (ns). The top-level elements in the schemas have the same name 
> (topelem), but different types (type1 and type2).

...

> As far as I know the schema specs forbids having two elements with the 
> same name and different type in the same content model.
You've actually mixed two rules there, but you're probably right on both 
of them:

1) There cannot be two declarations for the same element name at the top 
level.  This requirement exists whether or not those elements are ever 
used in any content model.

2) If the same element name appears more than once in a given content 
model, then references must be to the same declaration.

You might ask how rule #2 could ever be broken given rule #1?  Answer: 
yes, because in addition to top level declarations, you can have local 
ones, so rule #2 forbids:

<sequence>
  <element name="e" type="integer"/>
  <element name="e" type="float"/>
</sequence>

Note that the following is permitted:


<sequence>
  <element name="e" type="integer"/>
  <element name="e" type="integer"/>
</sequence>

I think Michael Kay has given you the right advice on tooling.  If your 
tools compile your two schema documents (that's the proper name for the 
files you've written for your schemas) separately, then obviously there's 
no conflict.  If your tool is pulling both of them into the same 
"compilation" (what the schema recommendation would call composing them 
into a single schema), then there is a conflict with rule #1.  As Michael 
says, tools are free to use command line options, defaults, or other means 
to decide which schema documents (files) are to be processed together to 
make a schema.

Noah


--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------

Received on Tuesday, 23 January 2007 19:49:52 UTC