Je travaille sur une mission et j'ai obtenu mon résultat, mais il m'a semblé que j'avais oublié de déclarer les éléments dans mon fichier DTD. Est-ce que je déclare tous les éléments ou seulement les éléments avec des informations supplémentaires? Si je ne suis pas clair, voici un extrait de ma mission:Comment déclarer des éléments DTD?
<entry id= 'c01'>
<MetaTags>Business</MetaTags>
<title><brand>HP Pavilion</brand><name>550-112NA</name></title>
<Desciption>While other towers have been standing still, HP has revolutionized the category. From magnified performance and reliability, to its stylish redesign, this HP Pavilion is the best thing to happen to towers in over 20 years.</Desciption>
<Price>€579</Price>
<Image src ="Image1.jpg"/>
<Specs>
<CPU>A10-8750 APU</CPU>
<GPU>Radeon R7</GPU>
<RAM>8 GB DDR3</RAM>
<Storage><HDD> 2TB </HDD><SSD></SSD></Storage>
<OS>Windows 10</OS>
<optional>
<Monitor>LG 22" Full HD TV</Monitor>
<Keyboard>Microsoft Wired Keyboard 600</Keyboard>
<Mouse>Logitech M705 Mouse</Mouse>
</optional>
</Specs>
</entry>
Est-ce que l'entrée de l'étiquette doit être déclarée, mais pas d'autres éléments seraient parce qu'ils ne disposent pas d'autres variables?
Si c'est exact, la déclaration serait ressembler à ceci:
<!ATTLIST entry id CDATA #REQUIRED>
J'espère que je fais ma question est claire, comme je suis nouveau à mon DTD XML.Here si vous avez besoin de voir que, et si je fais quelque chose d'autre qui ne va pas. Merci!
<!ELEMENT ComputerShop (entry+)>
<!ELEMENT entry (MetaTags, title, Description, Price, Image, Specs)>
<!ELEMENT MetaTags (#PCDATA)>
<!ELEMENT Description (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
<!ELEMENT Image (#PCDATA)>
<!ELEMENT title (brand, name)>
<!ELEMENT brand (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT Specs (CPU, GPU, RAM, Storage, OS, optional)>
<!ELEMENT CPU (#PCDATA)>
<!ELEMENT GPU (#PCDATA)>
<!ELEMENT RAM (#PCDATA)>
<!ELEMENT Storage (HDD | SSD)>
<!ELEMENT OS (#PCDATA)>
<!ELEMENT optional (Monitor | Keyboard | Mouse>
<!ELEMENT Monitor (#PCDATA)>
<!ELEMENT Keyboard (#PCDATA)>
<!ELEMENT Mouse (#PCDATA)>
Merci!