Defining the Structure and Content of an XML Document
Two main approaches to defining the format and contents of XML documents are Document Type Definitions (DTDs) and XML schemas. However, before discussing DTDs and XML schemas, let’s discuss the format of an XML document.
Well-Formed and Valid XML Documents
XML documents are considered well-formed if they follow the rules in the XML specification regarding document structure. Let’s take a look at some of the more important points related to well-formed documents.
An XML document can only have one root element, that is, the top level of the document tree. For example, in the following XML document, the root element is named <employees>:
<?xml version="1.0" encoding="UTF-8"?> <employees> ...
Get XML and Perl now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.