0

If I define an element such as this in a DTD

<!ELEMENT ud (#PCDATA)>

Are the following both valid?

<ud>foo &amp; bar</ud>
<ud><![CDATA[foo & bar]]></ud>
Dónal
  • 185,044
  • 174
  • 569
  • 824

1 Answers1

1

Both are valid.

Placing content in a <![CDATA[]]> section effectively means that whatever is in it will be ignored by the parser.

PCDATA means only character data is allowed. CDATA means, character data, so it is allowed within a PCDATA context.

Oded
  • 489,969
  • 99
  • 883
  • 1,009