Notations, subschemas, entities

John Cowan (cowan@locke.ccil.org)
Thu, 04 Jun 1998 15:54:00 -0400


Toby Speight wrote:

> I can't remember (nor find easily in the spec) whether notations must
> be declared before use.

There seems to be no such requirement. The VC simply says:
"Values of this type [i.e., notation] must match one of the notation
names included in the declaration; all notation names in the
declaration must be declared."

> John> Indeed, I'm thinking that XSchemas should have structure, ...
>
> Sorry, you lost me with this paragraph. Can you illustrate it with an
> example?

In other words:

<DOCTYPE root="blah">
<DOCTYPE>
<ELEMENT id="blah"> ... </ELEMENT>
<ELEMENT id="bazz"> ... </ELEMENT>
<NOTATION id="foo"> ... </ELEMENT>
</DOCTYPE>
<DOCTYPE>
<ELEMENT id="zim"> ... </ELEMENT>
<DOCTYPE>
<ENTITY ...> ... </ENTITY>
<ENTITY ...> ... </ENTITY>
<ELEMENT id="zam"> ... </ELEMENT>
</DOCTYPE>
</DOCTYPE>

In one sense it would be better to have a separate element for
grouping declarations, but using the same element for both
root and subordinate allows direct incorporation of XSchemas
into other XSchemas either by cut-and-paste or by external
text entities, as I mentioned before.

> I'm not keen on arbitrary markup, because I'm interested in processing the
> documentation with DSSSL to give a pretty-printed human-readable document
> to go with the DTD. It's hard to do that if you don't know what elements
> to expect.

Out of my depth.

> And, as I mentioned, we'll want some XSchema-specific elements
> to refer to ELEMENT definitions (for example).

XLink can do that using "#elementname", but that may not be the
Right Thing.

My concern is that we will bloat the simple XSchema DTD with
elements for marking up fancy text. If we were going to do that,
we'd need a subschema (see above!) that handled just the bare bones
of fancy text, preferably in an HTML-compatible way.

(I do happen to have such a thing in my back pocket....)

> <!ELEMENT EXTERNAL-ENTITY (DOC)>
> <!ATTLIST EXTERNAL-ENTITY
> %external;
> notation CDATA #IMPLIED>
> <!ELEMENT INTERNAL-ENTITY (DOC)>
> <!ATTLIST INTERNAL-ENTITY
> value CDATA #REQUIRED>

Using an attribute value to hold the definition of an internal
entity involves processing out all markup characters (&, <, ', "),
thus:

<!ENTITY yutz 'I use &int-entity; and refer to "&ext-entity;"'>

would come out as

<INTERNAL-ENTITY value="I use &amp;int-entity; and refer to &quot;&amp;ext-entity;&quot;"/>

whereas

<INTERNAL-ENTITY><![CDATA[I use &int-entity, and refer to "&ext-entity"]]></INTERNAL-ENTITY>

is far more readable and writable.

The spec should say that the content of an ENTITY element should be
wrapped in a CDATA marked section.

-- 
John Cowan	http://www.ccil.org/~cowan		cowan@ccil.org
	You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
	You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
		Clear all so!  'Tis a Jute.... (Finnegans Wake 16.5)