All About Elements

The most important (and frequently encountered) type of markup is the element tag. An element consists of an element open tag (for example, <name>), which is possibly followed by character data and additional elements, and an element close tag (</name>). Unlike HTML, XML requires that element open and close tags must match. This means that if an element begins with a <name> tag, it must end with a matching </name> closing tag. Mismatched tags will generate a well-formedness error (like a syntax error) in an XML parser. For example, the following tag sequence would generate an error if it were used in an XML document:

<p>This is the first line,<br>and this is the second.</p>

Although this is a perfectly valid HTML tag sequence, ...

Get Strategic XML 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.