If a document is not well-formed, it is not XML, in a technical sense.
An HTML tag such as is unacceptable in XML; the tag should be written to be well-formed XML.
The root element is the only element in an XML document that does not have a parent. In addition to the nesting of elements that create the parent-child relationships, XML elements can also have attributes.
It is a subset of Standard Generalized Markup Language (SGML); it offers a text-based means to apply and describe a tree-based structure to information. Tags are usually named to reflect the type of content contained in the element.
XML serves as the basis for a number of languages/formats, such as Really Simple Syndication (RSS), Mozilla's XML User Interface Language (XUL), Macromedia's Maximum e Xperience Markup Language (MXML), Microsoft's e Xtensible Application Markup Language (XAML), and the open source Java XML UI Markup Language (XAMJ). You would expect an element named book to contain a book title, such as Great American Novel (see Listing 1).
Some background about XML will allow you to understand its importance to the PHP developer and allow you to understand and create straightforward XML documents.
Extensible Markup Language (XML) is described as both a markup language and a text based data storage format, depending on who you talk to. If you fail to include an end tag for each start tag, your XML document is not well-formed, and parsers will not parse the document properly.
A parser won't parse XML properly if it is not well-formed.
Additionally, an XML document must have one and only one root element.
One of XML's good qualities is its relative simplicity.
You can write XML with basic text editors and word processors, no special tools or software required.
In Listing 1 above, the element possesses two attributes, "bestseller" and "bookclubs".
There are different schools of thought among XML developers about the use of attributes.
Some of XML's advantages are its self-documenting, human, and machine-readable format, its support for Unicode, which allows for internationalization in human language support, and its stringent syntax and parsing requirements.