[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
How to find and remove unproductive elements from XML Schemas
- From: "Costello, Roger L." <costello@mitre.org>
- To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Tue, 29 Apr 2014 11:22:40 +0000
Hi Folks,
At the bottom of this message is an XML Schema. It looks innocent: all its elements are declared and it does not exhibit any suspicious constructions. And it validates just fine.
But it contains unproductive elements: The B-element loops infinitely.
Unproductive elements are dead wood and should be removed.
I wrote a mini-tutorial that describes how to systematically find and remove unproductive rules:
http://xfront.com/formal-languages/How-to-find-and-remove-unproductive-rules-from-a-grammar.pptx
/Roger
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Document">
<xs:complexType>
<xs:choice>
<xs:element name="S1">
<xs:complexType>
<xs:sequence>
<xs:element name="A">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="a" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="S2">
<xs:complexType>
<xs:sequence>
<xs:element name="B" type="B-type" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name="B-type">
<xs:sequence>
<xs:element name="B" type="B-type" />
</xs:sequence>
</xs:complexType>
</xs:schema>
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]