W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2001

Re: [Moderator Action] FW: question on attributes

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 10 Feb 2001 11:44:31 +0000
To: "Fisseha, Haeran" <hfisseha@netfish.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <f5bd7cq3gps.fsf@cogsci.ed.ac.uk>
"Fisseha, Haeran" <hfisseha@netfish.com> writes:

> I wanted to ask if W3C Schema standards allow the use of sequential
> identical child elements
> that are differentiated only by the value of an attribute

Allow: of course.  Provide for requiring: not in v.1.

> For instance OAG BODs make use of attribute values to distinguish identical
> elements. for example the
> DATETIME element which can be used multiple times by using different values
> for the
> qualifier attribute.  Thus we have the SHIPMENT element that can have
> multiple children
> with the same element name DATETIME  but with different attribute values as
> seen in the DTD below
> 
> <!ELEMENT SHIPMENT ((%DATETIME.DOCUMENT;), (%AMOUNT.DECLAREVAL;)?,
> (%AMOUNT.DOCUMENT.T;)?, (%AMOUNT.ESTFREIGHT;)?, (%AMOUNT.FREIGHT.T;)?,
> (%AMOUNT.ITEM.T;)?, (%DATETIME.CREATION;)?, (%DATETIME.DELIVACT;)?,
> (%DATETIME.DELIVSCHED;)?, (%DATETIME.EARLSTSHIP;)?, (%DATETIME.LOADING;)?,
> (%DATETIME.NEEDDELV;)?, (%DATETIME.PROMDELV;)?, (%DATETIME.PROMSHIP;)?,
> (%DATETIME.SHIP;)?, (%DATETIME.SHIPSCHED;)?, 
> 
> the "qualifier" attribute of the child element DATETIME can have up to 68
> values so the same element can appear multiple times.  Currently we see this
> in both the DTD and xdr versions of OAG BOD 161.  Does the spec for W3C
> schema allow
> this?

Neither DTD nor XDR can _enforce_ this, unless I misunderstand.  What
my earlier investigation into OAG suggested was that the stylized
parameter entities which appear above (e.g. DATETIME.PROMDELV) are an
attempt to provide both element (PROMDELV) and type (DATETIME)
information.  This _can_ be reconstructed in XML Schema, very well:

<xs:sequence>
 ...
 <xs:element name="PROMDELV" type="oag:DATETIME" minOccurs="0"/>
 ...
</xs:sequence>

The use of .T and .F to signify subtypes is also possible:

 <xs:complexType name="AMOUNT.T">
  <xs:complexContent>
   <xs:restriction base="oag:AMOUNT">
    <xs:attribute name="type" use="required" fixed="T"/>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>

 ...
 <xs:element name="FREIGHT" type="oag:AMOUNT.T" minOccurs="0"/>

I hope this helps -- it's based on looking at the OAG DTDs over a year 
ago, so sorry if I've misunderstood.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Saturday, 10 February 2001 06:44:44 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:50 UTC