XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
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>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS