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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Strong Typing in SGML and XML

[ Lists Home | Date Index | Thread Index ]
  • From: Peter Newcomb <peter@techno.com>
  • To: tbray@textuality.com
  • Date: Tue, 6 May 1997 15:29:24 -0400

> Date: Mon, 05 May 1997 17:09:21 -0700
> From: Tim Bray <tbray@textuality.com>
> 
> Ever since about 15 minutes after SGML was born, database people have been
> discovering, to their surprise, that it contains no facilities for
> strong data typing.  You can have an element named <BIRTH-DATE>, and
> SGML will have no problem accepting 
> 
> <birth-date>purple bananas rule</birth-date>.

It seems to me that this sort of data typing can already be
accomplished:

<!NOTATION SQL-DATE PUBLIC "...//NOTATION SQL DATE//EN">
<!ELEMENT birth-date - - (#PCDATA)>
<!ATTLIST birth-date
   notation NOTATION (SQL-DATE) #FIXED SQL-DATE
>

Using data attributes, and HyTime's Data Attributes For Elements
(DAFE) facility (which acts as if the data content notation for an
element were an architectural form), one could implement a scheme like
the one you (Tim) propose:

<!NOTATION SQL-DATE PUBLIC "...//NOTATION SQL DATE//EN">
<!ATTLIST #NOTATION SQL-DATE
   sql-min CDATA #IMPLIED
   sql-max CDATA #IMPLIED
>
<!ELEMENT birth-date - - (#PCDATA)>
<!ATTLIST birth-date
   sql-type NOTATION (SQL-DATE) #FIXED SQL-DATE
   sql-min CDATA #FIXED "1900-01-01" -- some bogus restrictions --
   sql-max CDATA #FIXED "1999-12-31"
>

Or better yet:

<!NOTATION SQL-DATATYPE PUBLIC "...//NOTATION SQL DATATYPE//EN">
<!ATTLIST #NOTATION SQL-DATATYPE
   sql-type NAME #REQUIRED
   sql-size NUMBER 0
   sql-min CDATA #IMPLIED
   sql-max CDATA #IMPLIED
>
<!ELEMENT birth-date - - (#PCDATA)>
<!ATTLIST birth-date
   notation NOTATION (sql-datatype) #FIXED sql-datatype
   sql-type NAME #FIXED sql-date
   sql-min CDATA #FIXED "1900-01-01" -- some bogus restrictions --
   sql-max CDATA #FIXED "1999-12-31"
>

Of course, both of these require data attributes, which XML does not
(yet!) support.

-peter

--
Peter Newcomb                           TechnoTeacher, Inc.
233 Spruce Avenue                       P.O. Box 23795
Rochester, NY 14611-4041 USA            Rochester, New York 14692-3795 USA
+1 716 464 8696 (home)                  +1 716 464 8696 (direct)
+1 716 755 8698 (cell)                  +1 716 271 0796 (main)
+1 716 529 4304 (fax)                   +1 716 271 0129 (fax)
peter@petes-house.rochester.ny.us       peter@techno.com
http://www.petes-house.rochester.ny.us  http://www.techno.com

xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@ic.ac.uk)





 

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

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