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

XML Schema context sensitive?

From: Holger Meuss <meuss@cis.uni-muenchen.de>
Date: Tue, 24 Apr 2001 17:24:12 +0200
To: www-xml-schema-comments@w3.org
Cc: meuss@loihi.cis.uni-muenchen.de
Message-Id: <01042417241201.12832@loihi>
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 11:24:23 GMT

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