W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2001

RE: XML Schema context sensitive?

From: Fuchs, Matthew <matthew.fuchs@commerceone.com>
Date: Tue, 24 Apr 2001 10:48:07 -0700
Message-ID: <4C4A7BE77CE1D311A1D200508BA38C1202F355B6@venus.commerceone.com>
To: "'Holger Meuss'" <meuss@cis.uni-muenchen.de>, www-xml-schema-comments@w3.org
Cc: meuss@loihi.cis.uni-muenchen.de
There is a natural tendency in looking at Schema and DTDs to confuse
terminals and non-terminals.  The following BNF is a context free grammar
for your schema:

S := A | B
B := <b>C_1</b>
A := <a>C_2</a>
C_1 :=<c>_int_</c>
C_2 :=<c>_string_</c>
_int_ := regex for int
_string_ := regex for string

It is true that XML Schema currently has a black hole in that it can't
easily distinguish the different local declarations for C, but look at the
formal description working draft (http://www.w3.org/TR/xmlschema-formal/)
which provides such a naming scheme (which may itself be extended to be
useable in contexts beyond the formalization).  In the formalization, all
declarations are normalized and given top level names, so the context free
nature of the language is more evident.

Matthew

> -----Original Message-----
> From: Holger Meuss [mailto:meuss@cis.uni-muenchen.de]
> Sent: Tuesday, April 24, 2001 8:24 AM
> To: www-xml-schema-comments@w3.org
> Cc: meuss@loihi.cis.uni-muenchen.de
> Subject: XML Schema context sensitive?
> 
> 
> Hello,
> 
> I think the general opinion is that XML Schema can represent 
> context free 
> grammars, but no context sensitive grammars. 
> 
> I think that XML Schema **can** represent context sensitive grammars. 
>  by means of local element declarations? Would you please 
> correct if I'm 
> wrong after considering the following example:
> 
> Schema:
> ***********************************************************
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <schema>
> 
> <element name="A">
>   <complexType>
>     <element name="C" type="string"/>
>   </complexType>
> </element>
> <element name="B">
>   <complexType>
>     <element name="C" type="integer"/>
>   </complexType>
> </element>
> 
> </schema>
> 
> Instances:
> ***********************************************************
> 
> The following instance is valid:
> 
> <A xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
>        xsi:noNamespaceSchemaLocation="kontextSensitiv.xsd">
>   <C> abc </C>
> </A>
> 
> whereas 
> 
> <B xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
>        xsi:noNamespaceSchemaLocation="kontextSensitiv.xsd">
>   <C> abc </C>
> </B>
> 
> is not valid. The reason for this is an explanation in 
> Section 2.2.3 of the 
> Primer:
> 
> "If the two things are elements within different types (i.e. 
> not global 
> elements), say I declare one element called name as part of 
> the USAddress 
> type and a second element called name as part of the Item 
> type, there is no 
> conflict. (Such elements are sometimes called local element 
> declarations.)"
> 
> Yours,
> Holger
> 
Received on Tuesday, 24 April 2001 13:49:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:50 GMT