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]
RE: [xml-dev] Confusing XSD sequence/group.

Yea that did it !!! name vs. ref ...
DUH 

The reason Michael got the error was I didn't include the whole XML file.
If you put MEMBER at the root then it triggers the right rules.
But if MEMBER is a child of OBJECT  (in my real (and big)) XML file  the
original xsd wasn't referencing the MEMBER object I had so carefully
defined,
but was making up one out of thin air !

Changed name to ref and voila ! Errors :)

Thanks all


----------------------------------------
David A. Lee
dlee@calldei.com
http://www.xmlsh.org

-----Original Message-----
From: Pete Cordell [mailto:petexmldev@codalogic.com] 
Sent: Sunday, December 19, 2010 6:14 PM
To: David Lee; xml-dev@lists.xml.org
Subject: Re: [xml-dev] Confusing XSD sequence/group.


Where you have <xsd:element name="MEMBER"/> in OBJECT, you probably want to 
do <xsd:element ref="MEMBER"/> (i.e. name -> ref.)  Otherwise the type of 
the MEMBER element is the default type which is xs:anyType and it will 
accept any content.

Similarly your <xsd:element name="NULL"/> definition might not be giving you

what you want.  Based on the name I imagine you want <xsd:element 
name="NULL"><xsd:complexType/></xsd:element> to allow <NULL/> only.

HTH,

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using C++ XML
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
for more info
----- Original Message ----- 
From: "David Lee" <dlee@calldei.com>
To: <xml-dev@lists.xml.org>
Sent: Sunday, December 19, 2010 10:34 PM
Subject: [xml-dev] Confusing XSD sequence/group.


>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
>
> <mailto:dlee@calldei.com> dlee@calldei.com
>
> <http://www.xmlsh.org> http://www.xmlsh.org
>
>
>
> 




_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



[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