This series consists of two parts. EDD dumbill analyzes the different HTML methods proposed by web authors, browser developers, and standards bodies. This series will introduce the progressive method described in the whatwg specification and the radical method of the W3C proposed XHTML re-launch. In addition, the author will briefly introduce W3C's new rich client activity. This article is part 1 of the series. EDD looks at what W3C is doing to indicate the future of Web markup.
In the previous article in this series, I explained why HTML should be improved, including correcting past errors and adapting to the increasing requirements of web pages and applications. I introduced the work of Web hypertext Application Technology Working Group (whatwg) in creating web applications 1.0 and web forms 2.0 specifications, a loose consortium composed of browser vendors.
This article describes how the World Wide Web Consortium (W3C) builds the next generation of XHTML standard versions, and how they respond to the "rich client" behavior requirements represented by Ajax applications.
Four W3C Working Groups are establishing some particularly interesting specifications:
- HTML (now XHTML)
- XForms
- Web API
- Web application format
You can find links to these specifications in references. This article mainly discusses the research of the HTML Working Group, but it is also necessary to discuss other norms as background knowledge, because these studies will create the future of web.
XForms
XForms is the successor of the current HTML form proposed by W3C. They are designed to provide richer features and pass the results as XML documents to the processing application. XForms is modular, so it can be used in any context, not just bundled into XML. The main differences between XForms and HTML forms are:
- XForms separates the user interface representation from the data model definition.
- XForms allows you to create and consume XML documents.
- XForms is device neutral. For example, you can use the same form in the Voice Browser and desktop browser.
- XForms allows you to verify and constrain input before submission.
- XForms can implement multi-stage forms without using scripts.
Because it is a modular language, XHTML 2.0 introduces the XForms module to implement form functions.
Web API
The W3C Web API workgroup is responsible for developing standard APIs for client web applications. Among them, the first and most common API is the core of AJAX (also a technology described by whatwg ).XMLHttpRequest
Function. Programmers can use these APIs in any language supported by ecmascript and other browser environments.
Other APIs that may be developed include:
- Processing Browser
Window
Object API
- Dom Level 3 events and XPath specifications
- Time event API
- APIs used for non-HTTP networking, such as XMPP or sip
- Client persistent storage API
- Drag and Drop API
- Monitor the downloaded API
- File update API
Although these APIs may not be implemented along with XHTML 2.0, in the next four years, browsers may combine the two aspects to provide a rich platform for Web applications.
Web application format
XHTML 2.0 is part of Web application user interface problems, but not all. Mozilla XUL and Microsoft XAML provide rich XML vocabulary for user interfaces.
The Web application format workgroup is responsible for the development of declarative personas of a specified user interface and the Development of xbl2 according to XUL or XAML, this is a declarative language that provides binding between custom tags and existing technologies. In fact, xbl2 provides programmers with a way to write new web application components.
Why create XHTML 2.0?
The purpose of XHTML 1.0 is to convert HTML into an XML vocabulary. It introduces XML syntax constraints for HTML: case-sensitive, attribute values that must be enclosed by quotation marks, and pairs of tags. The task is completed. XHTML 2.0 is committed to solving the problem of HTML as a Web Page Markup Language.
W3C Steven Pemberton explained the design goals of XHTML 2005 in his speech at the xtech 2.0 conference in Amsterdam (see references:
- Try to use XML: If a language feature already exists in XML, do not repeat or reinvent it.
- Structure higher than Representation: Thanks to the CSS style sheet, HTML no longer requires special presentation tags.
- Make HTML easier to write: Delete unnecessary features in HTML.
- Higher accessibility and device neutrality: Try to avoid reading the document.
- Improved Internationalization.
- Better forms: Long-awaited Improvement!
- Reduce script requirements: HTML contains typical script usage.
- Better Semantics: Makes HTML and Semantic Web applications easier to integrate.
For anyone who has used HTML, these goals are clearly worth looking forward. Now I will examine in detail some methods of implementing these goals in XHTML 2.0.
Chapters and paragraphs
When I first came into contact with HTML many years ago, I still remember being overwhelmed by the text structure elements of this language many times. Why is there a six-layer title? When can it be used properly? Moreover, why does the title not contain the chapters they represent? XHTML 2.0 provides a new answer to this problem.<section>
And(Heading) element.
This arrangement is more logical than XHTML 1.0, and many other users who mark the vocabulary are also familiar with it. A major benefit for programmers is that they can include content chapters in a document without re-encoding the title hierarchy.
You can use CSS for these titles. People may expect that part of the default implementation of the xhtml 2.0 Browser can be pre-defined, which may be like the following (from the XHTML 2.0 specification ):
h {font-family: sans-serif; font-weight: bold; font-size: 200%}section h {font-size: 150%} /* A second-level heading */section section h {font-size: 120%} /* A third-level heading */
|
Another logic in XHTML 1.0 is that to use the list, you must put the list in the Section. In fact, you must use any block-level elements (BLOCKQUOTE, pre-formatted chapters, tables, etc ). This is often not logical if the content is only part of the same paragraph stream. XHTML 2.0 removes these restrictions. The only restriction is that one paragraph cannot be placed in another paragraph.
Image
In HTML
Labels are actually very inflexible. As Pemberton saidalt
Text (blocking the adoption of new image formats) does not contain any strain mechanisms,alt
Text cannot be marked,longdesc
Attributes are clumsy and never used. (longdesc
Provides a URI that points toalt
The description in the attribute is more detailed than that in the description .)
XHTML 2.0 provides a good solution to this problem: AllowAnyElement hassrc
Attribute. The browser can use the content in this URI to replace the content in the element. The simplest case is processing images. But no one says it cannot be any content type that can be rendered by SVG, XHTML, or browsers.
The tag itself will be retained, but it now contains some content.src
The new operation of the attribute meansalt
The text is now converted into element content, for example, the following example:
<p>H<sub>2</sub>O</img></p>
|
This is good news for languages such as Japanese, because Ruby annotations (see references) require intra-row marking, which was previously impossible in attribute values.
XHTML 2.0 in<object>
The element provides a more general form of image inclusion, which can be used to include executable code of any object type, from images, movies to flash or Java technology. In this way, you can use clever technology to make better appointments based on browser capabilities,<object>
Elements can be nested in multiple layers. For example, the outermost layer is a flash movie, which contains an AVI video file. The next layer is a static image, and the core of the nested object is a piece of text content. For more information, see the XHTML Object Module (link in reference ).
Scalable Semantics
For a long time, some HTML elements have semantic links, such<address>
And<title>
. The problem is that such elements are rare and cannot be expanded. In the meantime, someone tried to useclass
Attributes provide semantics for HTML elements. Andclass
Compared with the original design intention, this greatly extends its functions, and because CSS style attributes are widely used, it is difficult to clearly apply this usage. (Some people suspect thatclass
But the latter is hard to refute .)
XHTML 2.0 does not use these special methods, but introduces a method to specify metadata similar to RDF in the document. An RDF statement is a triple (subject, attribute, and object ). For example, there may be three English tuples: "My car", "is painted", and "red ".
about
Attributes are similarSubjectOfrdf:about
-- Can be omitted, the document itself is the topic.property
A property is a referenced URI. (You can use abbreviations to specify the prefix to be declared. For more information, see XHTML 2.0 metainformation attributes module ).
Finally, the third value of the productkeyabout
Andproperty
The element content of the attribute, ifcontent
If the property value is null, NO content exists. This is an example. If you have used html<meta>
The tag is very familiar. It specifies the creator of the page header:
Now let's take a look at the example provided by Pemberton, which shows how to use metadata in a real document body:
This indicates that the title is also the title of the XHTML 2.0 document and is specified as the line title. At last, you don't have to write questions twice in each document!
Thanks to a simple conversion technology called grddl, which extracts the resource description from the language dialect, gleaning resource descriptions from dialects of ages, see references, now we have a unified standard for extracting RDF metadata from XHTML 2.0 documents.
XHTML 2.0 also has many changes in other aspects, most of which are related to other parallel development specifications (such as XForms. The features of XHTML 2.0 cannot be described here. However, in any case, XHTML 1.0 is a great leap compared with XHTML 2.0.
Other changes in XHTML 2.0
Enough to write<pre><code> ... </code></pre>
This type of code? Now you can use the new<blockcode>
Element.
To meet the accessibility requirements, XHTML 2.0 providesrole
Attribute, which can be specified in any body element. For example, simple navigation elements on a page can be usedrole="navigation"
Attribute so that the text-Speech engine can intelligently process it.
The browser currently supportsTabKeyword for focus switching, but there is a lot of randomness. Newnextfocus
Andprevfocus
Attribute allows you to control the sequence of focus shifting between screen elements. This attribute is important for creating a user interface that can be navigated.
Welcome to XHTML 2.0
Regardless of the changes in advanced features, XHTML 2.0 is undoubtedly still HTML. Although new elements are added, most elements of XHTML 2.0 still work as they used. From the compatibility perspective, XHTML 2.0 is retainedToAnd
.
However, the XHTML 2.0 strategy is not backward compatible with strict syntax, so the HTML rendering engine of the existing browser cannot fully cope with the ability to express XHTML 2.0 documents. In any case, most Web browsers can present arbitrary XML + CSS, and a large number of XHTML 2.0 can also be presented in this way-although semantic Improvements cannot be achieved.
Some of the differences in XHTML 2.0 are very important. Switching to XForms is the most noteworthy, and the non-XML nature of HTML is completely abandoned. Therefore, you cannot change your website to XHTML 2.0 at once, but you can prepare for the future:
- Stick to CSS and remove all representation marks.
- Consider how to deploy on the pageMicroformats. Micro-formats can use existing standards in HTML (see references) to represent metadata.
- If you have not done so, use XHTML 1.0 for an experiment. Now it is possible to use the XHTML 1.0 page as the regular HTML, as long as it can be written according to the XHTML 1.0 HTML compatibility guidelines, but this will bring a lot of complexity. You cannot use this method in XHTML 2.0. For more details, see references.
- Experiment with the X-Smiles browser (see references). It supports XHTML 2.0 and provides SVG, XForms, and SMIL 2.0 basic capabilities.
- If you create a new client system based on the XHTML-like function, you must consider using XHTML 2.0 as the starting point.
Note that the XHTML 2.0 specification has not been completed yet. At the time of writing this article, the specification is still in the W3C draft phase, that is, there are still some ways to go before it becomes a recommendation standard. Importantly, it must also go through the candidate Recommendation Standard stage, which is used to collect implementation experience.
According to the W3C HTML workgroup plan, XHTML 2007 is unlikely to become the W3C recommendation standard by 2.0. That is to say, 2006 is a crucial year to gain deployment experience.
Comparison between W3C XHTML 2.0 and whatwg HTML 5
These two articles introduce the main features of whatwg HTML 5 and W3C XHTML 2.0. The two plans are completely different: the grassroots whatwg wants to gradually improve HTML 4 and XHTML 1.0, and the XHTML 2.0 supported by the Alliance completely restructured the HTML language.
Although different, these two methods are comparable. Some preliminary results of the whatwg specification have been implemented in browsers. Some of the work of whatwg is to describe HTML fact extensions. Some important parts, suchXMLHttpRequest
Enter the W3C rich client activity specification. Whatwg is still an effective catalyst in the Web standard world.
Looking farther away, the XHTML 2.0 method provides a brand new vocabulary for the Web. At that time, the modular processing of XML, CSS and ecmascript will soon become common. Embedded devices such as phones and digital TVs do not have to support messy legacy Web HTML, so they can take advantage of the XML-only vocabulary XHTML 2.0 without any burdens. In addition, the new accessibility and internationalization features make XHTML 2.0 The first widely recognized XML document vocabulary, making it a solid and economic basis for many tag-based jobs.
Like in the past, the future of HTML is also uncertain, and some may call it confusing, but I believe that XHTML 2.0 will eventually be widely accepted and accepted. If this is the only XML Vocabulary on the web, there may be some problems, but because the browser is ready to deal with SVG, XForms and other technologies, XHTML 2.0 seems to be just another XML-based vocabulary.