Syntax of an XML Document

An XML document contains only text data. Therefore, an XML document can be easily created or edited with any simple text editor. An XML document does not contain any pre-defined tags, but XML adopts a strict syntax for defining data in the XML document. This section discusses various rules one should follow while creating an XML document.

NOTE

Well-Formed XML Document If an XML document conforms to the XML syntax, it is known as a well-formed XML document.

Here's a concrete example to start with. This XML file represents data for two customers:

 <?xml version="1.0" encoding="UTF-8"?> <!-- Customer list for Bob's Tractor Parts --> <Customers> <Customer CustomerNumber="1"> <CustomerName>Lambert Tractor Works </CustomerName> ...

Get MCAD/MCSD Training Guide (70-320): Developing XML Web Services and Server Components with Visual C#™ .NET and the Microsoft .NET Framework 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.