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

Re: Strong Typing in SGML and XML

  • From: Peter Newcomb <peter@t...>
  • To: tbray@t...
  • Date: Tue, 6 May 1997 15:29:24 -0400

sql min
> Date: Mon, 05 May 1997 17:09:21 -0700
> From: Tim Bray <tbray@t...>
> 
> 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@p...       peter@t...
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@i... the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@i...)


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.