The XML Declaration

Let's look at the first line of the CarParts.xml file:

<?xml version='1.0' standalone='yes'?>

This is called the XML declaration line and should be the first line of any XML document. This statement identifies that the document is an XML document, and that the contents that follow are lines of XML code.

The XML declaration also describes the version of XML with which the code is compliant, and whether the document is standalone. A standalone document is a document in which the XML parser does not need to reference an external document type definition (DTD) to figure out whether the XML code being parsed is valid. If the value for the standalone document had been no, the parser would have had to reference the specified external ...

Get Java™ APIs for XML Kick Start 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.