Controlling link destination DOCTYPE

W. Eliot Kimber eliot at isogen.com
Mon Apr 6 22:31:35 BST 1998


At 12:54 PM 4/6/98 -0700, John Tigue wrote:
>     Is there any way (XML, HyTime, etc.) to declare that an ENTITY
>     attribute is not only an ENTITY attribute but that the value
>     must be of a particular declared NOTATION? That is, the
>     entity must be declared to have a particular NDATA? Or is this
>     simply application level constraints not parser level?

HyTime provides a partial solution: reference type control. Very simply,
you can associate referential attributes (e.g., an ENTITY attribute) with a
list of element types that an attribute can address. You use the "reftype"
attribute, like so:

<!ELEMENT linkToABarDoc EMPTY >
<!ATTLIST linkToABarDoc
          docLinkingTo ENTITY #REQUIRED
          reftype
            CDATA 
            #FIXED "docLinkingTo myBarDoc"
          HyTime
            NAME
            #FIXED "clink"
          HyNames
            CDATA
            #FIXED "linkend docLinkingTo"
          >

This simply says "the element addressed by the docLinkingTo attribute must
be a myBarDoc element". Note that, by HyTime (and XPointer) rules, a
reference to a document is shorthand for a reference to its root element.
[the HyTime and HyNames attributes are there to complete the architectural
mapping from the element to the clink element type defined by the HyTime
architecture--they enable a HyTime-aware processor to recognize that the
reftype attribute is the one defined by HyTime.]

However, this doesn't really solve John's problem, which is to constrain
the reference to documents that use a particular set of element type
declarations, not the element type of the document element (which could
vary depending unless the declarations declare exactly one element type). 

There is no HyTime facility for doing this (although perhaps there should be).

However, you could define your own application convention for doing it:

<!ELEMENT linkToABarDoc EMPTY >
<!ATTLIST linkToABarDoc
          docLinkingTo ENTITY #REQUIRED
          doctype-constraint
            CDATA 
            #FIXED "docLinkingTo 'The BarDecls PUBLIC ID'"
          >

Where "doctype-constraint" is like reftype except that the second parameter
is the public ID of the external DTD subset of the document referenced by
the docLinkingTo attribute, not the element type.

Of course, the external declaration subset is not reliable as no document
need have one (even if it uses the same declarations explicitly by copying
them into the internal subset or using a normal external parameter entity).
What you really need is an "architecture use constraint" that requires that
the referenced document be derived from a specific SGML architecture:

<!ELEMENT linkToABarDoc EMPTY >
<!ATTLIST linkToABarDoc
          docLinkingTo ENTITY #REQUIRED
          arch-use-constraint
            CDATA 
            #FIXED "docLinkingTo 'The BarDecls Architecture PUBLIC ID'"
          >

In both cases, the constraint checking can be easily implemented using any
processor with access to the DOCTYPE properties or architecture use
declaration (either in PI form, as would be used for XML documents, or
notation declaration form, as can be used with SGML documents).  Even if
not implemented, it conveys the author's intent about the constraints on
the reference.

In neither case would the parser enforce these constraints--these are
processor-specific semantic constraints, not parse-time constraints (in
other words, you parse the document and then process it to resolve links
and addresses, at which time you would check and enforce these constraints.

Cheers,

Eliot
--
<Address HyTime=bibloc>
W. Eliot Kimber, Senior Consulting SGML Engineer
Highland Consulting, a division of ISOGEN International Corp.
2200 N. Lamar St., Suite 230, Dallas, TX 95202.  214.953.0004
www.isogen.com
</Address>

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list