I'm currently trying to write a DTD for an XML file.
In the xml I came across this type of things :
<CHAMP NAME="JBRTHDTC" DOMAIN="DM" DB="YES:CRF" TYPE="JOUR" FORCED="YES" AFFICHE="YES">
<![CDATA[ Date de naissance: ]]>
<MESSAGE><![CDATA[Date de naissance (Jour)]]></MESSAGE>
</CHAMP>
Is it ok to have CDATA and a xml element inside another?
If so, how can I manage to write it in DTD? Like
ELEMENT CHAMP (MESSAGE?|CDATA??)>
You have to declare
CHAMP
as a mixed content model.This means that
CHAMP
can contain either#PCDATA
(parsed character data) orMESSAGE
. (You can still haveCDATA
sections in the mixed content model.)This has to be declared a certain way, so you won't be able to limit the number of occurrences of
MESSAGE
. It's zero or more#PCDATA
orMESSAGE
in any order.Example: