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

Re: having problems using the all compositor


cos all limited.1.2
1. I suspect the example isn't anything like what you really want to write.
Otherwise, you would have seen that you could just drop the 1's and 2's, or
make them attribute values, and this would be easy. In XSD or DTD, the Table
content model would look like:

attribute*,out_of_hierarchy_table*,child_table*

Where each would be written, e.g., <attribute type="1">name</attribute>.

2. If, however, each attributeN, out_of_heirarchy_tableN and child_tableN
actually have different names and there is a good reason not to use
attribute values, instead, you could do this in XML Schema + Schematron by
using the pattern (a|b)* for the unordered parts with Schematron constraints
like "count(a)=1 and count(b)=1".

3. Or, you could write it directly in RELAX NG. In the compact syntax this
would be:

start = element Table { attributes, out_of_hierarchy_tables, child_tables }
attributes = element attribute1 {text} & element attribute2 {text}
out_of_hierarchy_tables =
  element out_of_hierarchy_table1 {attributes}
& element out_of_hierarchy_table2 {attributes}
child_tables =
  element child_table1 {attributes}
& element child_table2 {attributes}

4. Or, as previously suggested, you could drop the unordered requirement
because XML Schema alone can't express it.

Bob Foster

----- Original Message -----
From: "Bill Riegel" <BRiegel@l...>
To: <xml-dev@l...>
Sent: Monday, June 16, 2003 9:24 AM
Subject:  having problems using the all compositor


> Structure
>
> <Table>
>   <attribute1>name</attribute1>
>   <attribute2>5</attribute2>
>   <out_of_hierarchy_table1>
>     <attribute1>red</attribute1>
>   </out_of_hierarchy_table1>
>   <out_of_hierarchy_table2>
>     <attribute1>green</attribute1>
>   </out_of_hierarchy_table2>
>   <child_table1>
>     <attribute1>cow</attribute1>
>   </child_table1>
>   <child_table2>
>     <attribute1>horse</attribute1>
>   </child_table2>
> </Table>
>
> Desire:
> What to have an order that dictates:
> Table's attributes occurs first
> Out_of_hiearchy_tables occur second
> Child_tables occur last.
>
> But with each group allow an un-order list.
> i.e. allow attribute2 before attribute1
>      allow out_of_hiearchy_table2 before out_of_hierarchy_table1
>      allow child_table2 before child_table1
>
> With Schema:
>
> <xs:schema targetNamespace="http://www.lgc.com/schema/OpenWorksData/2003"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:targetns="http://www.lgc.com/schema/OpenWorksData/2003"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>   <xs:element name="Table" type="targetns:TableType"/>
>   <xs:complexType name="TableType">
>     <xs:sequence>
>       <xs:group ref="targetns:Table_Atrributes_Group"/>
>       <xs:group ref="targetns:Table_OOHParents_Group"/>
>       <xs:group ref="targetns:Table_Children_Group"/>
>     </xs:sequence>
>   </xs:complexType>
>
>   <xs:group name="Table_Atrributes_Group">
>     <xs:all>
>       <xs:element name="attribute1" type="xs:string"/>
>       <xs:element name="attribute2" type="xs:integer"/>
>     </xs:all>
>   </xs:group>
>
>   <xs:group name="Table_OOHParents_Group">
>     <xs:all>
>       <xs:element name="out_of_hierarchy_table1">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="attribute1" type="xs:string"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>       <xs:element name="out_of_hierarchy_table2">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="attribute1" type="xs:string"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>     </xs:all>
>   </xs:group>
>
>   <xs:group name="Table_Children_Group">
>     <xs:all>
>       <xs:element name="child_table1">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="attribute1" type="xs:string"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>       <xs:element name="child_table2">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="attribute1" type="xs:string"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>     </xs:all>
>   </xs:group>
> </xs:schema>
>
>
> I get the following error output:
>
> Table.xml:3:Error:  cos-all-limited.1.2: A group whose content is "all"
must
> only appear as the content type of a complex type definition.  Saw group
in
> "sequence".
> Table.xml:3:Error:  cos-all-limited.1.2: A group whose content is "all"
must
> only appear as the content type of a complex type definition.  Saw group
in
> "sequence".
> Table.xml:3:Error:  cos-all-limited.1.2: A group whose content is "all"
must
> only appear as the content type of a complex type definition.  Saw group
in
> "sequence".
> Table.xml:24:The content of element type "Table" must match "EMPTY".
>
> Is there another way to achieve my desired goals ?
>
> Note: XMLSpy is happy with the above XMLSchema.
>
> Bill Riegel
> LandMark Graphics
> 713-839-3388
>
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
>


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.