W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2007

RE: Are two schemas different content models?

From: <noah_mendelsohn@us.ibm.com>
Date: Tue, 23 Jan 2007 14:49:41 -0500
To: "Michael Kay" <mike@saxonica.com>
Cc: Daniel.Dui@ubs.com, xmlschema-dev@w3.org
Message-ID: <OF98D47D39.AD30D3B8-ON8525726C.006C2F0F-8525726C.006CC477@lotus.com>

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:

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

Note that the following is permitted:

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

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 Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
Received on Tuesday, 23 January 2007 19:49:52 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:39 UTC