Lists Home |
Date Index |
Bob DuCharme <firstname.lastname@example.org> 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.
| 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 ?>
PUBLIC "etc etc"
PUBLIC "etc etc"
<!-- more like above, for all needed data types, and then -->
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
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.