SGML

Data Entities Examples

data-entities/datatext1.sgm
basic test showing that eg. STAGO delimiters get escaped in data text entities
data-entities/datatext2.sgm
general entity references/ERO characters in data text entities are ignored
data-entities/datatext3.sgm

OTOH, parameter entity references in data text entities do get expanded

data-entities/datatext4.sgm
references to undeclared parameter entities in data text entities get flagged as errors and expanded into the empty string
data-entities/datatext-parament.sgm
parameter entities cannot be CDATA or SDATA
data-entities/extdatatext1.sgm

the syntax for declaring external general data entities requires using a notations; references to data text entities don't get expanded by SP but reproduced as-is in the output (arguably this is bogus, since when using the sgmlnorm program which doesn't output the DTD we'll end up with invalid/non-reparseable output); $productname, OTOH, does expand CDATA and SDATA data entities (but not NDATA entities); moreover, any result document produced by $productname will always contain a DTD

data-entities/extdatatext2.sgm

SDATA is treated like CDATA when used in data entity declarations

data-entities/datatext1.sgm

<!doctype test [
	<!element test - - (#pcdata)>
	<!entity ent cdata "text with escaped <> delimiters">
]>
<test>&ent</test>

data-entities/datatext2.sgm

<!doctype test [
	<!element test - - (#pcdata)>
	<!entity refdent cdata "text containing what looks like an &entity reference">
	<!entity ent cdata "text with escaped <> delimiters and unexpanded &refdent entity references">
]>
<test>&ent</test>

data-entities/datatext3.sgm

<!doctype test [
	<!element test - - (#pcdata)>
	<!entity % refdent "parameter entity replacement text">
	<!entity ent cdata "text with escaped <> delimiters and expanded %refdent parameter entity reference">
]>
<test>&ent</test>

data-entities/datatext4.sgm

<!doctype test [
	<!element test - - (#pcdata)>
	<!entity ent cdata "text with escaped <> delimiters and expanded %refdent parameter entity reference">
]>
<test>&ent</test>

data-entities/datatext-parament.sgm

<!doctype test [
	<!element test - - (#pcdata)>
	<!entity % refdent cdata "parameter entity replacement text">
	<!entity ent cdata "text with escaped <> delimiters and expanded %refdent parameter entity reference">
]>
<test>&ent</test>

data-entities/extdatatext1.sgm

<!doctype test [
	<!element test - - (#pcdata)>
	<!notation n system "somenotation">
	<!entity ent system "extdatatext1.txt" cdata n>
]>
<test>&ent</test>

data-entities/extdatatext2.sgm

<!doctype test [
	<!element test - - (#pcdata)>
	<!notation n system "somenotation">
	<!entity ent system "extdatatext1.txt" sdata n>
]>
<test>&ent</test>