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] "Datatypes" for DTDs

[ Lists Home | Date Index | Thread Index ]

Bob DuCharme <bobdc@snee.com> wrote:

| All right, here's my trick for datatypes in DTDs [...]

| To summarize: for simple element types, instead of the e-dtype 
| attribute used by DT4DTD, use a #FIXED xsi:type attribute described
| in section 2.6.1 (http://www.w3.org/TR/xmlschema-1/#xsi_type) of XML 
| Schema Part 1, which is used more widely.

Ugh. :-(
 
| For attribute typing, I do have parameter entity trick, but I thought 
| it was better than the DT4DTD one. 

AFAIK, DT4DTD doesn't use PEs.  This is one of its major virtues.  (Maybe
you meant that you like the trick itself better?)  Personally, I view any
method needing PEs to be basically broken.

For completeness, let me outline one version of the external entity hack.
Assume a declarative mechanism (say, a PI) which identifies the name of a
distinguished attribute.  For concreteness, let this name be type-map.  It
will have a declared value of NAMES (NMTOKENS in XML); the names will be
of other attributes on the same element type.  The first of these names
will be that of an attribute with declared value ENTITIES, the rest of
attributes for which data types will be "mapped" by the entities named in
the first attribute (in a correspondence list fashion).  These entities,
in turn, are placeholder public identifiers with associated notations, and
these notations name the data types.  Putting it all together, you have
something like this (using the example in the DT4DTD note):

   <?xml-typemap typemap ?>
   <!NOTATION  date 
               PUBLIC "etc etc" 
               >
   <!ENTITY    date-hook 
               PUBLIC "whatever" 
               SDATA date 
               >
   <!NOTATION  length 
               PUBLIC "etc etc" 
               >
   <!ENTITY    length-hook 
               PUBLIC "whatever" 
               SDATA length 
               >
   <!-- more like above, for all needed data types, and then -->
   <!ATTLIST   person
               birthdate  CDATA     #IMPLIED
               binding    CDATA     #IMPLIED
               typemap    NMTOKENS  #FIXED  "foo birthdate binding"
               foo        ENTITIES  #FIXED  "date-hook length-hook"
               >

Note that the typemap value will usually have one more name than the foo
"hook" to datatypes.  If the foo attribute has the same number, then the
first is the hook for the element type itself.  IOW, something like this

   <!ATTLIST   birthdate
               typemap   NMTOKENS   #FIXED   "foo"
               foo       ENTITIES   #FIXED   "date-hook"
               >

would mean that the data type applied to the #PCDATA content.

Note that even something as "old-fashioned" as the ESIS output of nsgmls
will report all the needed notations.

A similar hack is possible with LPDs too.
     




 

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

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