Page 1 of 1

minOccurs cant be in element??

Posted: Mon Mar 01, 2010 3:14 am
by Phix
I'm getting some XML/Schema stuff under my belt, and in doing so whipped up some XML:

Code: Select all

 
<iPhoneBackup>
    <contacts xsi:noNamespaceSchemaLocation="http://localhost/iPhone/contacts.xsd" total="120" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <entry dbid="116" uid="106">
            <first>Tester</first>
            <middle>Eugene</middle>
            <last>Smith</last>
            <nickname>Stevereeno</nickname>
            <org>MyComp Inc.</org>
                <telData>
                    <phone type="mobile">(408)555-1212</phone>
                    <phone type="iphone">(408)555-1324</phone>
                </telData>
                <webData>
                    <email type="work">jimb.smith@work.com</email>
                    <email type="home">jombeanw@gmail.com</email>
                    <url type="work" href="http://www.hellothere.com/pag.php">http://www.hellothere.com/pag.php</url>
                </webData>
                <adrData>
                    <address type="Work">
                        <street>555 Blocked Rd - Suite 2020</street>
                        <state>CA</state>
                        <zipCode>93372</zipCode>
                        <city>Fremont</city>
                        <country>us</country>
                    </address>
                </adrData>          
                <chatData>
                    <handle client="aim" label="home">Mrbean</handle>
                    <handle client="yahoo" label="work">Mrbeanwork</handle>
                </chatData>
            </entry>
    </contacts>
</iPhoneBackup>
 
And an accompanying XSD:

Code: Select all

 
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="entry">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="first" type="xs:string"/>
                <xs:element name="middle" type="xs:string"/>
                <xs:element name="last" type="xs:string"/>
                <xs:element name="nickname" type="xs:string"/>
                <xs:element name="org" type="xs:string"/>
                <xs:element name="telData">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="phone" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="webData">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="url" type="xs:string"/>
                            <xs:element name="email"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="adrData">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="address">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="street" type="xs:string"/>
                                        <xs:element name="state" type="xs:string"/>
                                        <xs:element name="zipCode" type="xs:string"/>
                                        <xs:element name="city" type="xs:string"/>
                                        <xs:element name="country" type="xs:string"/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="chatData">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="handle" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
 
EditX 2k9 says it validates, but I don't understand why it throws an error with this:

Code: Select all

 
<xs:element name="entry" minOccurs="1">
 
Error: s4s-att-not-allowed: Attribute 'minOccurs' cannot appear in element 'element'.

But it's one of the options in the auto-complete, and the little I know in my XSD road, it should be allowed.

Forgive me if my schema isn't 100% accurate, I just started tryin' to figure em recently. So is this an EditX error or an error in the XML-Schema relationship?