Which of the following statements is/are true? P: An XML document with correct…
2019
Which of the following statements is/are true? P: An XML document with correct syntax as specified by W3C is called "well-formed". Q: An XML document validated against a DTD is both "well-formed" and "valid". R: <xml version="1.0" encoding="UTF-8"> is a syntactically correct declaration for the version of an XML document. Select the correct answer from the options given below:
- A.
P and Q only
- B.
P and R only
- C.
Q and R only
- D.
All of P, Q and R
Attempted by 273 students.
Show answer & explanation
Correct answer: A
Final answer: P and Q only
P is true: A document that follows the W3C syntax rules (properly nested tags, a single root element, quoted attribute values, etc.) is called well-formed.
Q is true: If a document validates against a DTD, it must first be well-formed and, by passing validation, is also declared valid with respect to that DTD.
R is false: The XML declaration must use the processing-instruction syntax and look like <?xml version="1.0" encoding="UTF-8"?>. The given text uses <xml ...> without the required <? and ?>, so it is not a correct XML declaration.
Because P and Q are true and R is false, the correct selection is P and Q only.
A video solution is available for this question — log in and enroll to watch it.