Title: Theory / Unimportant / CS / Descriptive / XML / DTD
Tags: hasNotNewEffectReturnsMeaning instruction FromInstruction computer_to_instruction automatedNewLineAfterCommaSpace examplesSwitchExample1 hasSeenConjDef récupéré seen_description

Name: Document type definition
Definition: Elements
Page: https://www.w3schools.com/xml/xml_dtd_intro.asp
https://www.w3schools.com/xml/xml_dtd_building.asp
Definition2: Attributes
Conjdef: A list of
Definition3: Entities
Abbreviation: DTD
Definition4: PCDATA
Definition5: CDATA

Instruction: <!DOCTYPE note [foo]>
Page: https://www.w3schools.com/xml/xml_dtd_intro.asp
Effect: Declare that the DTD of this XML document is foo

Instruction: <!DOCTYPE note SYSTEM "foo">
Page: https://www.w3schools.com/xml/xml_dtd_intro.asp
Effect: Declare that the DTD of this XML appears in file foo

Instruction: <!ELEMENT foo ANY>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element with any combination of parsable data
Context: DTD
Example: br

Instruction: <!ELEMENT foo bar>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element in category bar
Context: DTD

Instruction: <!ELEMENT foo (bar_1|bar_2)>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element with children containing one of the bar_i
Context: DTD

Instruction: <!ELEMENT foo EMPTY>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element with empty content
Context: DTD
Example: br

Instruction: <!ELEMENT foo (#PCDATA)>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element with parsed character data
Context: DTD
Example: br

Instruction: <!ELEMENT foo (
  bar_1,
  ...,
  bar_n
)>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element with children exactly equal to bar_1, ..., bar_n
Context: DTD

Instruction: <!ELEMENT foo (bar+)>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element with children containing bar at least once
Context: DTD

Instruction: <!ELEMENT foo (bar*)>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element with children containing some occurrence of bar
Context: DTD

Instruction: <!ELEMENT foo (bar?)>
Page: https://www.w3schools.com/xml/xml_dtd_elements.asp
Effect: state that foo is an element with children containing at most one occurrence of bar
Context: DTD

Name: Element
Definition: Main building blocks of XML
Page: https://www.w3schools.com/xml/xml_dtd_intro.asp
Context: DTD

Name: Attributes
Definition: Extra informations about elements
Page: https://www.w3schools.com/xml/xml_dtd_intro.asp
Context: DTD

Name: Entities
Definition: Symbols with a special meaning in XML
Page: https://www.w3schools.com/xml/xml_dtd_intro.asp
Context: DTD
Example: < is referenced by &lt;

Name: parsed character data.
Definition: Text between a start and an end tag
Page: https://www.w3schools.com/xml/xml_dtd_intro.asp
Context: DTD
Abbreviation: PCDATA

Name: character data.
Definition: Text which will not be parsed
Page: https://www.w3schools.com/xml/xml_dtd_intro.asp
Context: DTD
Abbreviation: CDATA

Instruction: <!ATTLIST foo buz bar bing>
Page: https://www.w3schools.com/xml/xml_dtd_attributes.asp
Effect: Declaring that buz is an attribute of the element foo with type bar and value bing
Context: DTD

Question: Attributes values are
Answer: value (default value)
Page: https://www.w3schools.com/xml/xml_dtd_attributes.asp
Context: DTD
Answer2: #Required
Answer3: #IMPLIED (optional without default)
Answer4: #FIXED value

Question: Rule for choosing between attribute or child element
Answer: metadata (id) as attribute, everything else as child element
Page: https://www.w3schools.com/xml/xml_dtd_el_vs_attr.asp