Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

Elements

XML elements must have as their element type name a legal XML name as defined in the preceding section.

Additionally, the element type name in the start tag must match the element type name in the end tag. It is important to remember that XML is case sensitive. Any of the following tag pairs will generate well-formedness errors because of case differences:

<title></TITLE>
<title></Title>
<title></Title>

Balanced Start and End Tags

Each start tag must have a corresponding end tag, properly nested. The following example is correctly nested:

<oneElement>Some text
 <anotherElement>Some other text
 </anotherElement>
<oneElement>

The end tag of the anotherElement element must appear before the end tag of the oneElement element.

If an element is empty (that is, it has no content, not even a single whitespace character), the start tag/end tag pair can be written as an empty element tag. The following

<someElement myAttribute="someInformation"></someElement>

is equivalent to writing this:

<someElement myAttribute="someInformation"/>
  • + Share This
  • 🔖 Save To Your Account