<title>ASP.NET 2.0 Beta Preview</title> <author>Bill Evjen</author> <year></year> |
</book> |
</books> |
In this example, books is the document element, book elements are children of books, and title, and author are children of book. The book elements contain no data (just other elements), but title, and author contain data. The following line in the second book element contains neither data nor other elements. |
<year></year> |
Empty elements are perfectly legal in XML. An empty year element can optionally be written this way for conciseness: |
<year/> |
Unlike HTML, XML requires that start tags be accompanied by end tags; therefore, the following XML is never legal: |
<year>2003 |
Also unlike HTML, XML is case-sensitive. A<year> tag closed by a </ Year> tag is not legal because the cases of the Ys do not match. |
Because XML permits elements to be nested within elements, the content of an XML document can be viewed as a tree. By visualizing the document structure in a tree, you can clearly understand the parent- child relationships among the document’s elements. |