WEB-DEVELOPMENT-FOUNDATION practice question 15 of 15
What is an example of a self-closing XML tag?
Full set: 75 questionsIn XML (Extensible Markup Language), a self-closing tag, also known as an empty-element tag, is used for elements that do not contain any content between an opening and closing tag. The syntax for a self-closing tag is . It combines the start-tag and end-tag into a single tag by placing a forward slash (/) immediately before the closing angle bracket (>). Option D, , correctly follows this required syntax.
A. is invalid XML syntax. The forward slash is misplaced, and the start and end identifiers within the tag do not match.
B. is a standard closing tag. It is used to mark the end of an element that has a separate opening tag and typically contains content.
C. is a standard opening tag. It would require a corresponding closing tag, such as , to form a complete element.
1. W3C, Extensible Markup Language (XML) 1.0 (Fifth Edition) Recommendation:
Section 3.1, Start-Tags, End-Tags, and Empty-Element Tags: The specification defines the syntax for an EmptyElemTag as ''. This formal definition directly matches the structure of . The document states, "Empty-element tags may be used for any element which has no content..."
2. MDN Web Docs, XML basics:
Section: The basic rules of XML: This document explains, "For elements that have no content, you can use a self-closing tag. For example, is a valid XML element." This confirms that a tag ending with /> is the correct format for a self-closing element.
3. MIT OpenCourseWare, 6.005 Software Construction, Reading 19: Taming the World with XML:
Section: XML Syntax: The course material illustrates XML syntax, showing examples of empty elements like
. This demonstrates the standard practice and syntax for self-closing tags in an academic context.
Keep practicing
Take the free WEB-DEVELOPMENT-FOUNDATION practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other WEB-DEVELOPMENT-FOUNDATION practice questions
- Question 2What is one of the possible values of the text-align property?
- Question 3What is matched by the :hover selector?
- Question 4What describes the matches resulting from the img: first-child selector?
- Question 5Which two color definitions are valid for use with CSS? Choose 2 answers.
- Question 8What does the timelines tool of Safari Web Inspector enable a developer to do?
- Question 9Developers consider three platforms for viewport sizes. What is one of them?
