<%@ include file="../../ga4.jsp" %> DTD Construction [XML] - Quiz Explanation

DTD construction- Quiz Explanation

The correct answers are indicated below, along with text that explains the correct answers.
 
1. Which of the following choices describes a DTD element that contains both text and other child elements?
Please select the best answer.
  A. Complex Declaration
  B. Character elements
  C. Tree structure
  D. Mixed content
  The correct answer is D.
A DTD element that contains both text and other child elements has mixed content. Answer A is incorrect because there are no complex declarations in the DTD. Answer B is incorrect because there are no character elements in content definition. Answer C is incorrect because an element content is a separate concept from structure.

2. Which of the following declarations must every XML document that uses a DTD have?
Please select the best answer.
  A. A <!DTD> declaration
  B. A <STANDALONE> declaration
  C. A <DOCTYPE> declaration
  D. A <!DOCTYPE> declaration
  The correct answer is D.
Every XML document that uses a DTD must have a <!DOCTYPE> declaration. Answer A is incorrect because there no <!DTD> declaration. Answer B is incorrect because there is no <STANDALONE> declaration; standalone is an attribute. Answer C is incorrect because the syntax of the <!DOCTYPE> declaration is incorrect.

3. Which of the following syntaxes should you use to declare that your DTD is in a separate file?
Please select the best answer.
  A. <?xml version="1.0" standalone="no"?>
  B. <!doctype standalone="no">
  C. <?xml version="1.0" standalone="yes"?>
  D. <!doctype standalone="yes"!>
  The correct answer is A.
The syntax to declare that a DTD is in a separate file is <?xml version="1.0" standalone="no"?>. Answer B is incorrect because the syntax is incorrect.
Answer C is incorrect because the standalone attribute value should be "no".
Answer D is incorrect because the syntax is incorrect.