Flashcards on Introduction to XML: Syntax and Validation

Introduction to XML: Syntax and Validation for Students

1 / 28

Where can a DTD declaration be placed within an XML document?

It can be placed directly within the document at the beginning, externally in a separate file, or as a combination of both (an external file with addi

Tap to flip · Swipe to navigate

DTD and XML Declaration

28 cards

Card 1

Question: Where can a DTD declaration be placed within an XML document?

Answer: It can be placed directly within the document at the beginning, externally in a separate file, or as a combination of both (an external file with addi

Card 2

Question: What does the basic XML header with an internal DTD declaration look like at the beginning of a document?

Answer: It starts with <?xml version="1.0" encoding="UTF-8"?>, followed by <!DOCTYPE root [ ...internal declarations... ]>, and then the <root>...</root> elem

Card 3

Question: How do you specify an external DTD using SYSTEM or PUBLIC?

Answer: You use <!DOCTYPE root SYSTEM "path"> for non-public standards, or <!DOCTYPE root PUBLIC "identifier" "path"> for public standards (e.g., SVG, RSS).

Card 4

Question: Where should the DTD declaration be placed relative to the XML declaration?

Answer: The <!DOCTYPE ...> declaration (either internal or a reference to an external DTD) is placed immediately after the <?xml ...?> declaration.

Card 5

Question: What does a combined DTD declaration mean?

Answer: It refers to an external DTD using <!DOCTYPE ... SYSTEM "link.dtd"> while also including additional internal commented or active element declarations

Card 6

Question: What is the syntax for an element declaration in DTD?

Answer: <!ELEMENT name (content)> where content can be #PCDATA, other elements, or a combination (e.g., (firstname, surname)).

Card 7

Question: How do you specify text content for an element in DTD that should be parsed (with entities processed)?

Answer: You use #PCDATA in the element declaration, for example, <!ELEMENT phone (#PCDATA)>.

Card 8

Question: How do you specify content in DTD that should not be parsed (e.g., HTML or JavaScript)?

Answer: CDATA denotes unparsed text (character data) that the parser will not process as tags or entities.

Card 9

Question: What quantifiers does DTD support for the number of element occurrences, and what do they mean?

Answer: * means zero or more, + means one or more, ? means zero or one; if no quantifier is specified, exactly one is required.

Card 10

Question: Provide an example of an element declaration with quantifiers (buildings, address, student, brewery).

Answer: <!ELEMENT university (building+, address, student*, brewery?)> means: at least one building, exactly one address, zero or more students, and optionall