- XML Reference Guide
- Overview
- What Is XML?
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Table of Contents
- The Document Object Model
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- DOM and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Implementations
- DOM and JavaScript
- Using a Repeater
- Repeaters and XML
- Repeater Resources
- DOM and .NET
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Downloads
- DOM and C++
- DOM and C++ Resources
- DOM and Perl
- DOM and Perl Resources
- DOM and PHP
- DOM and PHP Resources
- DOM Level 3
- DOM Level 3 Core
- DOM Level 3 Load and Save
- DOM Level 3 XPath
- DOM Level 3 Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- The Simple API for XML (SAX)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SAX and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- SAX and .NET
- Informit Articles and Sample Chapters
- SAX and Perl
- SAX and Perl Resources
- SAX and PHP
- SAX and PHP Resources
- Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Document Type Definitions (DTDs)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Schemas
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- RELAX NG
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Schematron
- Official Documentation and Implementations
- Validation in Applications
- Informit Articles and Sample Chapters
- Books and e-Books
- XSL Transformations (XSLT)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XSLT in Java
- Java in XSLT Resources
- XSLT and RSS in .NET
- XSLT and RSS in .NET Resources
- XSL-FO
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XPath
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Base
- Informit Articles and Sample Chapters
- Official Documentation
- XHTML
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XHTML 2.0
- Documentation
- Cascading Style Sheets
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XUL
- XUL References
- XML Events
- XML Events Resources
- XML Data Binding
- Informit Articles and Sample Chapters
- Books and e-Books
- Specifications
- Implementations
- XML and Databases
- Informit Articles and Sample Chapters
- Books and e-Books
- Online Resources
- Official Documentation
- SQL Server and FOR XML
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- Service Oriented Architecture
- Web Services
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Creating a Perl Web Service Client
- SOAP::Lite
- Amazon Web Services
- Creating the Movable Type Plug-in
- Perl, Amazon, and Movable Type Resources
- Apache Axis2
- REST
- REST Resources
- SOAP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SOAP and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- WSDL
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- UDDI
- UDDI Resources
- XML-RPC
- XML-RPC in PHP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Ajax
- Asynchronous Javascript
- Client-side XSLT
- SAJAX and PHP
- Ajax Resources
- JSON
- Ruby on Rails
- Creating Objects
- Ruby Basics: Arrays and Other Sundry Bits
- Ruby Basics: Iterators and Persistence
- Starting on the Rails
- Rails and Databases
- Rails: Ajax and Partials
- Rails Resources
- Web Services Security
- Web Services Security Resources
- SAML
- Informit Articles and Sample Chapters
- Books and e-Books
- Specification and Implementation
- XML Digital Signatures
- XML Digital Signatures Resources
- XML Key Management Services
- Resources for XML Key Management Services
- Internationalization
- Resources
- Grid Computing
- Grid Resources
- Web Services Resource Framework
- Web Services Resource Framework Resources
- WS-Addressing
- WS-Addressing Resources
- WS-Notifications
- New Languages: XML in Use
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Google Web Toolkit
- GWT Basic Interactivity
- Google Sitemaps
- Google Sitemaps Resources
- Accessibility
- Web Accessibility
- XML Accessibility
- Accessibility Resources
- The Semantic Web
- Defining a New Ontology
- OWL: Web Ontology Language
- Semantic Web Resources
- Google Base
- Microformats
- StructuredBlogging
- Live Clipboard
- WML
- XHTML-MP
- WML Resources
- Google Web Services
- Google Web Services API
- Google Web Services Resources
- The Yahoo! Web Services Interface
- Yahoo! Web Services and PHP
- Yahoo! Web Services Resources
- eBay REST API
- WordML
- WordML Part 2: Lists
- WordML Part 3: Tables
- WordML Resources
- DocBook
- Articles
- Books and e-Books
- Official Documentation and Implementations
- XML Query
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XForms
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Resource Description Framework (RDF)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Topic Maps
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation, Implementations, and Other Resources
- Rich Site Summary (RSS)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Simple Sharing Extensions (SSE)
- Atom
- Podcasting
- Podcasting Resources
- Scalable Vector Graphics (SVG)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- OPML
- OPML Resources
- Summary
- Projects
- JavaScript TimeTracker: JSON and PHP
- The Javascript Timetracker
- Refactoring to Javascript Objects
- Creating the Yahoo! Widget
- Web Mashup
- Google Maps
- Indeed Mashup
- Mashup Part 3: Putting It All Together
- Additional Resources
- Frequently Asked Questions About XML
- What's XML, and why should I use it?
- What's a well-formed document?
- What's the difference between XML and HTML?
- What's the difference between HTML and XHTML?
- Can I use XML in a browser?
- Should I use elements or attributes for my document?
- What's a namespace?
- Where can I get an XML parser?
- What's the difference between a well-formed document and a valid document?
- What's a validating parser?
- Should I use DOM or SAX for my application?
- How can I stop a SAX parser before it has parsed the entire document?
- 2005 Predictions
- 2006 Predictions
- Nick's Book Picks
Because we already have a Reference Guide section on XHTML, you may be wondering why we have a separate one for XHTML 2.0. After all, wouldn't it make sense to just update the other section?
Well, no.
When it comes to actual usage, XHTML 2.0 is a whole new animal. Or more accurately, XHTML 2.0 is not the same old animal. And that's what's really different about it. Over the years one of the guiding principles of HTML is that it has always been backwards-compatible. The newest browsers always read the oldest pages correctly.
Well, OK, they would read the old pages correctly, if the old pages had been coded correctly. That's actually how we got from HTML 4.01 to XHTML 1.0. Most of the "flexibility" that came from HTML's SGML roots, such as case-insensitivity, optional closing tags, and optional quotes around attribute values, was removed when HTML was subjected to the rules of XML and become XHTML 1.0. Creating a valid XHTML 1.0 page means no more being lazy about overlapping tags, and other bad habits. Also, structure was emphasised over presentation, which meant that you should be writing:
<&h1>The next steps</h1> <p>Once you've reversed the polarity of the neutron flow, open the rotor and restart the temporal oscillator.</p>
and not
<p style="font-weight: bold; font-size: 14pt;">The next steps</p> <p>Once you've reversed the polarity of the neutron flow, open the rotor and restart the temporal oscillator.</p>
But still, XHTML 1.0 and HTML 4.01 were pretty similar. A browser that understood one could understand the other, as long as you weren't requiring well-formed XML.
In most ways there was even less change between XHTML 1.0 and XHTML 1.1. In fact, the specs are the same, as far as content is concerned. The only difference was the way in which XHTML was "modularized" in definitions, and that has zero effect on most web developers.
And then came XHTML 2.0. Still in working draft status, XHTML 2.0 has one major, major difference from all that has come before.
It's not backwards compatible.
And we're not just talking about obscure tags like <big> here. We're talking major changes like the elimination of <b>, <i> and even <img>. Frames are gone completely (and good riddance), replaced with their next-generation counterpart, XFrames. Ditto for forms. This is not your father's HTML, folks.
The first major change, as I said, is in the elimination of presentation-related tags such as the bold and italics tags. That means you're going to be getting more use out of the seemingly useless <span> tag. In other words, instead of writing:
<p>Structure is <b>good</b>.</p>
You need to be writing
<style type="text/css"> .strong {font-weight: bold} </style> <p>Structure is <span class="strong">good</span>.</p>
(Or better yet,
<p>Structure is <strong>good</strong>.</p>
)
Images can now be added using the <object> tag, which enables you to present different levels of content based on the capacity of the browser, as in:
<object data="starfield.mov" type="application/mov"> <object data="starfield.jpg" type="image/jpg"> NASA has released new Hubble telescope pictures, strung together as an animation. </object> </object>
This method enhances accessibility, since authors can automatically provide alternate content for users who may be using text-only or even voice-only browsers. The browser starts at the outer tag (in this case, the movie) and keeps looking inside until it finds content it can handle.
XHTML 2.0 is all about adding meaning to your documents. For example, where you used to have six levels of headings, you can now explicitly organize your content into sections, as in:
<section> <h>Overview</h> <section> <h>What Is XML?</h> <p>A cousin of Hypertext Markup Language (HTML),...</p> </section> </section> <section> <h>Table of Contents</h> <section> <h>The Document Object Model</h> <p>The most common methodology for writing XML programs is the Document Object Model (DOM). ...</p> <section> <h>InformIT Articles and Sample Chapters</h> <p>"XML in .NET: The DOM Interface," by Dale Michalk, is a look at the Document...</p> </section> <section> <h>Books and e-Books</h> <p>The first two sections of ...</p> </section> <section> <h>Official Documentation</h> <p>The W3C maintains a Document Object Model main page that...</p> </section> </section> <section> <h>DOM and Java</h> ... </section> </section>
The advantage here is that search engines and other automatic programs can understand how pieces of information relate to each other, and sections are self-contained.
There's also a major change when it comes to linking. Although the <a> tag has not been removed, or even deprecated, it's now possible to make something a link without even using it. For example, in HTML you need to make an image a link like this:
<a href="home.html"> <img src="/images/logo.gif" alt="Logo" /> </a>
In some browsers, that carriage return after the image (but before the closing tag for the link) caused an annoying blue underline to appear on the page. In XHTML 2.0, you can just say:
<img src="/images/logo.gif" alt="Logo" href="home.html" />
In fact, in XHTML 2.0, anything can become a link this way, including entire sections or even the whole body of the page.
Other major changes? Well, as I said, frames have been removed. (They may eventually be replaced by XFrames, which are not officially part of XHTML 2.0 but provide solutions for problems such as bookmarking a page the user has already changed.) Forms have been replaced with XForms, which provide much more robust data validation and event handling without resorting to JavaScript. And speaking of events, one of the goals of XHTML 2.0 is to minimize reliance on scripting by incorporating XML Events. They've also taken great pains to increase usability and accessibility by emphasizing such information as captions and summaries.
XHTML 2.0 will be a while in coming, as no browsers currently support it, but it pays to understand the changes, so you can at least think about them when you're coding your current pages, and hopefully build them in such a way that any changes will be easy to implement.