SGML

Element Declaration Examples

element-declarations/dtd11 element-declarations/dtd12 element-declarations/dtd14
Parsing of basic SGML documents
element-declarations/dtd13 element-declarations/dtd15
Basic examples for error messages due to use of undeclared elements

element-declarations/dtd11

<!DOCTYPE TEST [
	<!ELEMENT TEST ANY>
]>
<TEST></TEST>

Result

<!DOCTYPE TEST [
	<!ELEMENT TEST ANY>
]>
<TEST></TEST>

element-declarations/dtd12

<!DOCTYPE TEST [
	<!ELEMENT TEST (A,B)>
	<!ELEMENT A EMPTY>
	<!ELEMENT B EMPTY>
]>
<TEST><A></A><B></B></TEST>

Result

<!DOCTYPE TEST [
	<!ELEMENT TEST (A,B)>
	<!ELEMENT A EMPTY>
	<!ELEMENT B EMPTY>
]>
<TEST><A></A><B></B></TEST>

element-declarations/dtd14

<!DOCTYPE TEST [
	<!ELEMENT TEST (A,B)>
	<!ELEMENT A EMPTY>
	<!ELEMENT B EMPTY>
]>
<TEST><A/><B/></TEST>

Result

<!DOCTYPE TEST [
	<!ELEMENT TEST (A,B)>
	<!ELEMENT A EMPTY>
	<!ELEMENT B EMPTY>
]>
<TEST><A></A><B></B></TEST>

element-declarations/dtd13

<!DOCTYPE TEST [
	<!ELEMENT TEST (A,B)>
	<!ELEMENT A EMPTY>
	<!ELEMENT B EMPTY>
]>
<TEST><A></A><C></C></TEST>

Result


"dtd13.sgm": line 6: fatal: 'C': undeclared element type and IMPLYDEF ELEMENT NO specified

element-declarations/dtd15

<!DOCTYPE TEST [
	<!ELEMENT TEST (A,B)>
	<!ELEMENT A EMPTY>
	<!ELEMENT B EMPTY>
]>
<TEST><A/><C/></TEST>

Result


"dtd15.sgm": line 6: fatal: 'C': undeclared element type and IMPLYDEF ELEMENT NO specified