Re: Strong Typing in SGML and XML
> 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!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format