[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Confusing XSD sequence/group.

  • From: Michael Kay <mike@saxonica.com>
  • To: xml-dev@lists.xml.org
  • Date: Sun, 19 Dec 2010 23:19:53 +0000

Re:  Confusing XSD sequence/group.
Are you sure? When I run it (with Saxon 9.3.0.2) I get

Processing file:/e:/temp/test.xml
Validation error on line 3 column 15 of test.xml:
  In content of element <MEMBER>: The content model does not allow element <STRING> to
  appear here. No further elements are allowed at this position (See
  http://www.w3.org/TR/xmlschema-1/#cvc-complex-type clause 2.4)

Michael Kay
Saxonica



On 19/12/2010 22:34, David Lee wrote:
001a01cb9fcc$d6ff2020$84fd6060$@calldei.com" type="cite">

I have an XSD with this group

 

<xsd:group name="value">
        <xsd:choice>
                <xsd:element name="STRING"/>
                <xsd:element name="NUMBER"/>
                <xsd:element name="NULL"/>
                <xsd:element name="OBJECT"/>
                <xsd:element name="ARRAY"/>

        </xsd:choice>
    </xsd:group>

 

 

I then use it in this element

 

<xsd:element name="MEMBER">
        <xsd:complexType>
            <xsd:sequence minOccurs="1" maxOccurs="1">
                <xsd:group ref="value" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="name" use="required"/>
        </xsd:complexType>
    </xsd:element>

 

 

 

----------------

 

 

I validate it against a document which has this fragment

 <MEMBER name="_text">
      <STRING>        </STRING>
      <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
        </STRING>                                          <STRING>
    </STRING>                                       

</MEMBER>

 

 

 

It validates as successful in every schema validator I've tried (including Saxon, XSV, MS XML).

 

What am I missing ???

I want to have MEBMER element contain One and Only One element of STRING|NUMBER|NULL|OBJECT|ARRAY

Thanks for any suggestions !

 

 

Here's the full schema

<?xml version="1.0"?>
<xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema>
    <xsd:element name="OBJECT">
        <xsd:complexType>
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="MEMBER"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="MEMBER">
        <xsd:complexType>
            <xsd:sequence minOccurs="1" maxOccurs="1">
                <xsd:group ref="value" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="name" use="required"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="ARRAY">
        <xsd:complexType>
            <xsd:sequence maxOccurs="unbounded" minOccurs="0">
                <xsd:group ref="value"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="STRING">
        <xsd:simpleType>
            <xsd:restriction base="xsd:string"/>
        </xsd:simpleType>
    </xsd:element>
    <xsd:element name="NUMBER">
        <xsd:simpleType>
            
            <xsd:restriction base="xsd:double"/>
            
        </xsd:simpleType>
    </xsd:element>
    <xsd:element name="NULL"/>
    <xsd:group name="value">
        <xsd:choice>
                <xsd:element name="STRING"/>
                <xsd:element name="NUMBER"/>
                <xsd:element name="NULL"/>
                <xsd:element name="OBJECT"/>
                <xsd:element name="ARRAY"/>

        </xsd:choice>
    </xsd:group>


</xsd:schema>

 

 

 

 

 

----------------------------------------

David A. Lee

dlee@calldei.com

http://www.xmlsh.org

 




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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.