RE: Comments on XML Schemas: Structures (long)

Murray Maloney wrote:

> >I disagree that there is no particular need to specify the expected root 
> >beforehand. In fact, many applications expect a particular root.  For
> >example, if I write a module that reads a schema and validates an 
instance
> >document against that schema, that module clearly expects the root 
element
> >of the schema to be <schema> and will throw an error if it is not.
>
> And, if it does not get <schema> as the root, it will reject the 
document,
> won't it? What difference would it make if the schema for schema said
> that schema was the root element? And, is there only one root?

Yes, it will reject the document. The difference in specifying the root 
element type in the schema is that it allows the check for the root element 
type to be moved from the application to the validation process. As a 
general rule, I think this is a good thing, as it moves more processing to 
general modules, which is one of the big advantages of XML over other data 
formats -- that is, less burden on application writers.

Obviously, the application will always have to do some validation and there 
needs to be a balance between things that are generic enough to go into 
schemas and things that should remain in the application. In my mind, root 
element types are generic enough to go into schemas.

There can be more than one possible root element type -- a document using 
any of the possible types would be valid. There is also no requirement that 
any root element types be specified in the schema.

>
> If there is only one root for a given schema, then it is detectable
> by inspection of the schema.
>
> If any/many of the elements in the schema can serve as the root, then
> what advantage is there in declaring that?

If any element type can be the root, there is no advantage. If many element 
types can be the root, the advantage is small. But if there is only one 
type, as I suspect many applications will require, there are the advantages 
noted above.

>
> >> >Section 3.6 -- Entities and Notations
> Do you think that they [notations] should be included with datatypes, 
perhaps?

With data types (some people have reasonably argued that notations are 
user-defined data types) or in a separate section of their own -- just not 
with entities. But this really is a minor point and is only really relevant 
if entities are split off as a separate language. In that case, I don't 
want notations to go with them.

-- Ron

Received on Thursday, 10 June 1999 05:09:43 UTC