OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] having problems using the all compositor

[ Lists Home | Date Index | Thread Index ]

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@lgc.com>
To: <xml-dev@lists.xml.org>
Sent: Monday, June 16, 2003 9:24 AM
Subject: [xml-dev] 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>
>
>





 

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

Copyright 2001 XML.org. This site is hosted by OASIS