In a Document Type Definition (DTD) an element can contain #PCDATA.
PCDATA in this context means mixed content, elements may contain character data, optionally interspersed with child elements.
| Sample PCDATA Usage within a DTD |
Copy Code
|
|---|---|
<!ELEMENT b (#PCDATA)> |
|
| Sample XML |
Copy Code
|
|---|---|
<b>character data</b> |
|
The element b may contain character data, and nothing else.
If used correctly in conjunction with other element types it can allow the element to contain mixed content.
| Sample PCDATA Usage within a DTD |
Copy Code
|
|---|---|
<!ELEMENT c (#PCDATA|d|e)*> |
|
| Sample XML |
Copy Code
|
|---|---|
<c>character data <d/> more text <d/> and more <e/></c> |
|
However PCDATA is not the semantic term for character data, and must appear as the first item within a 0-n choice.
The EBNF shows these limitations.DTD ELEMENT
[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*'
| '(' S? '#PCDATA' S? ')'