W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2005

Re: Using XML Schema inline?

From: <noah_mendelsohn@us.ibm.com>
Date: Tue, 22 Mar 2005 14:07:15 -0500
To: voss@null.dk (Jonas Voss)
Cc: xmlschema-dev@w3.org
Message-ID: <OF20FC234B.481B613A-ON85256FCC.0068583E@lotus.com>

FYI, there are deeper issues here.   The XML Recommendation explicitly 
provides for DTDs.  When you put a DTD "internal subset" into a document 
it is not part of the logical element content; it is metadata, as it 
should be in most cases.
 
Consider putting a schema into a document such as a resume:

        <resume>
                <xsd:schema>
                        ...
                </xsd:schema>
                <applicant>Mary Smith</applicant>
        </resume>

There is a sense in which you have made the schema part of the resume 
which in most cases is not what you really mean.  Unfortunately, XML is 
not extensible in this dimension.  There is only one schema language that 
is allowed in a first class manner.  The XML schema group wrestled with 
lots of ways around this, but the fundamental problem remains.  Similar 
lack of pluggability explains why Schemas cannot declare Entities in a way 
that XML would understand:  the XML rec only provides for entities to be 
declared in DTDs.

Anyway, you can see why the above somewhat discourages creating a 
standardized way of embedding a schema, because you necessarily are 
impacting the content of the document.   You really need the document 
format (resume) to anticipate the existence for the <schema>.  Indeed, the 
content model for the <resume> element would have to explicitly allow for 
and either validate or skip using a wildcard the schema elements. 

I haven't looked at how Microsoft is working around this.  There are a 
variety of conventions that can be use, including:

        <container>
                <xsd:schema>
                        ...
                </xsd:schema>
                <resume>
                        <applicant>Mary Smith</applicant>
                </resume>
        </container>

but then again you are into special cases.  Note that the Schema rec does 
allow, though not all processors support, validation of subtrees.  One of 
the many reasons was so that in the container example, the schema could be 
for just the resume if you prefer, and not necessarily for the container 
as a whole.

I always thought it ironic that the XML Recommendation, which is so 
extensible in a number of important dimensions, is so rigid in some 
others.

Noah

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








voss@null.dk (Jonas Voss)
Sent by: xmlschema-dev-request@w3.org
03/22/2005 09:39 AM

 
        To:     xmlschema-dev@w3.org
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        Re: Using XML Schema inline?



In gmane.text.xml.schema.devel, Michael Champion <mcham@microsoft.com> 
wrote:

> It's supported in the Microsoft XML tools, see
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/
> html/xmconvalidationinlineschemas.asp

> AFAIK this will not interoperate (except at the XML syntax level) with
> other tools.  Inline schema support seem to be consistent with the
> various Recommendations, but not mandated by any.  FWIW,
> http://www.codeguru.com/Csharp/Csharp/cs_data/xml/article.php/c4235/
> suggests avoiding inline schemas whenever possible.

Thank you very much for your answer, I'll wave it in front of my boss,
and see what he says.

~/j

-- 
|   Jonas @ 55.75, 12.42   |

 It's just a job. Grass grows, birds fly,
 waves pound the sand. I beat people up. - Muhammed Ali, 1977.
Received on Tuesday, 22 March 2005 19:07:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:49 GMT