XML Elements

Any XML document contains XML elements.

An XML element may contain other XML elements, may contain information, and can have attributes.

Example XML elements

<?xml version = "1.0" encoding = "UTF-8"?> <messages>     <message type="mail">         <from>James</from>         <to>Peter</to>         <title>Meeting</title>         <text>Remember our meeting</text>     </message> </messages>

This XML document contains the following XML:

<messages> Document root element
<message> element with the attribute "type" and also contains the elements <from>, <to>, <title> and <text>
<from> element containing information
<to> element containing information
<title> element containing information
<text> element containing information

To specify the name of an element, there are some rules:

If we use a compound name, for example to describe the title of a book, we can and we recommend using the underscore _ to separate words, and we could create the XML element named "book_title".

You can not create element names with accents