← Prev in month ← Prev in thread

How to find and remove unproductive elements from XML Schemas

From
Costello, Roger L. <>
To
"" <>
Date
2014-04-29T11:22:40Z
ID
<>
Thread
How to find and remove unproductive elements from XML Schemas
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>
← Prev in month ← Prev in thread