The XML Declaration

printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    

Java APIs for XML Kick Start
By Aoyon Chowdhury, Parag Choudhary

Table of Contents
Appendix B.  XML: A Quick Tour


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 DTD to determine the validity of the XML document.

A DTD is a document that defines the structure of the XML document and declares entities. An XML document can reference a DTD and use the structure and entities as defined in the DTD. In such cases, a validating XML parser can validate the XML document against the structure defined in a DTD. You will learn more about DTDs later in this appendix.

Note that although CarParts.xml is a standalone document, it still has a DTD. This DTD is defined within the CarParts.xml file, and is known as the internal subset. Similar to an external DTD, you can define elements, attributes, and entities within the internal subset. The declaration for the internal subset occurs in the <!DOCTYPE carparts [....]> line.


printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    
Top

[0672324342/app02lev1sec3]

 
 


JavaT APIs for XML Kick Start
JAX: Java APIs for XML Kick Start
ISBN: 0672324342
EAN: 2147483647
Year: 2002
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net