SGML

Model Group Exception Examples

exceptions/test1
Basic inclusion example
exceptions/test2
Basic rejected exclusion example
exceptions/test3
Basic accepted exclusion example
exceptions/test5
Invalid example where an element is both excluded and included at the same level; sgmlproc will say "element C is both included and excluded"
exceptions/test7
Accepted example with multiple in-/exclusions
exceptions/test8
Invalid example demonstrating that exclusions can't be overridden at lower levels
exceptions/test9
Example demonstrating cascaded inclusion
exceptions/test12
Demonstrates that, like with proper content model elements, an omitted end tag is inferred before an included subelement
Note: To process SGML from the example sources, copy and paste an example source, store it into a file with the ".sgm" file extension, and invoke
sgmlproc <your-file.sgm>
where <your-file.sgm> is replaced by the actual file used for storing.

exceptions/test1

<!DOCTYPE test [
	<!ELEMENT test - - (a, b) +(c)>
	<!ELEMENT a - - (#PCDATA)>
	<!ELEMENT b - - (#PCDATA)>
	<!ELEMENT c - - (#PCDATA)>
]>
<test><a></a><c></c><b></b></test>

exceptions/test2

<!DOCTYPE test [
	<!ELEMENT test - - (a, b?, c) -(b)>
	<!ELEMENT a - - (#PCDATA)>
	<!ELEMENT b - - (#PCDATA)>
	<!ELEMENT c - - (#PCDATA)>
]>
<test><a></a><b></b><c></c></test>

exceptions/test3

<!DOCTYPE test [
	<!ELEMENT test - - (a, b?, c) -(b)>
	<!ELEMENT a - - (#PCDATA)>
	<!ELEMENT b - - (#PCDATA)>
	<!ELEMENT c - - (#PCDATA)>
]>
<test><a></a><c></c></test>

exceptions/test5

<!DOCTYPE test [
	<!ELEMENT test - - (a, b) -(c) +(c)>
	<!ELEMENT a - - (#PCDATA)>
	<!ELEMENT b - - (#PCDATA)>
	<!ELEMENT c - - (#PCDATA)>
]>
<test><a></a><c></c><b></b></test>

exceptions/test7

<!DOCTYPE test [
	<!ELEMENT test - - (a, b*, c?) -(b|c) +(d|e)>
	<!ELEMENT a - - (#PCDATA)>
	<!ELEMENT b - - (#PCDATA)>
	<!ELEMENT c - - (#PCDATA)>
	<!ELEMENT d - - (#PCDATA)>
	<!ELEMENT e - - (#PCDATA)>
]>
<test><a></a><e></e></test>

exceptions/test8

<!DOCTYPE test [
	<!ELEMENT test - - (a, b*, c?) -(b|c) +(d|e)>
	<!ELEMENT a - - (b|c|#PCDATA) +(c)>
	<!ELEMENT b - - (#PCDATA)>
	<!ELEMENT c - - (#PCDATA)>
	<!ELEMENT d - - (#PCDATA)>
	<!ELEMENT e - - (#PCDATA)>
]>
<test><a><c></c></a><e></e></test>

exceptions/test9

<!DOCTYPE test [
	<!ELEMENT test - - (a, b*, c?) -(b) +(d|e)>
	<!ELEMENT a - - (b|c|#PCDATA) +(f)>
	<!ELEMENT b - - (#PCDATA)>
	<!ELEMENT c - - (#PCDATA)>
	<!ELEMENT d - - (#PCDATA)>
	<!ELEMENT e - - (#PCDATA)>
	<!ELEMENT f - - (#PCDATA)>
]>
<test><a><c></c><d></d></a><e></e></test>

exceptions/test12

<!DOCTYPE test [
	<!ELEMENT test - - (a, b, c)>
	<!ELEMENT a - O (d)>
	<!ELEMENT b O O (e*) +(x)>
	<!ELEMENT c - - (f)>
	<!ELEMENT d - - (#PCDATA)>
	<!ELEMENT e - - (#PCDATA)>
	<!ELEMENT f - - (#PCDATA)>
	<!ELEMENT x - - (#PCDATA)>
]>
<test><a><d></d><x></x><c><f></f></c></test>