eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Resources
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak

 

Introduction to XML For Web Developers
The XML Declaration  

To begin an XML document, it is a good idea to include the XML declaration as the very first line of the document. I say "good idea" because, though the XML declaration is optional, it is suggested by the W3C specification.

Essentially, the XML declaration is a processing instruction that notifies the processing agent that the following document has been marked up as an XML document. It will look something like the following:

<?xml version = "1.0"?>

We'll talk more about the gory details of processing instructions later, but we can at least explain how the XML declaration works.

All processing instructions, including the XML declaration, begin with <? and end with ?>. Following the initial <?, you will find the name of the processing instruction, which in this case is "xml".

The XML processing instruction, requires that you specify a "version" attribute and allows you to specify optional "standalone" and "encoding" attributes.

In its full regalia, the XML declaration might look like the following:

<?xml version = "1.0" standalone = "yes" encoding = "UTF-8"?>
The Version Attribute  
As we said before, if you do decide to use the optional XML declaration, you must define the "version" attribute. As of this writing, the current version of XML is 1.0. Note that if you include the optional attributes, "version" must be specified first.
The STANDALONE Attribute  
The "standalone" attribute specifies whether the document has any markup declarations that are defined in a separate document. Thus, if "standalone" is set to "yes", there will be no markup declarations in external DTD's. Setting it to "no" leaves the issue open. The document may or may not access external DTD's.
The ENCODING Attribute  
All XML parsers must support 8-bit and 16-bit Unicode encoding corresponding to ASCII. However, XML parsers may support a larger set. You'll rarely need to work with this, so I'll simply refer you to section 4.3.3 in the XML Specification document where you can get a list of encoding types and more.

Previous Page | Next Page | Table of Contents