|By Molly E. Holzschlag||
|March 7, 2001 12:00 AM EST||
The XML developer doesn't have to be convinced of XML's strength. You've heard it a million times: it's all about the data. The same is true on the client side. XHTML strongly embraces the separation of content and presentation, and brings XML's syntactical logic, as well as extensible opportunities, to the client-side table.
XHTML 1.0, a reformulation of HTML as an XML application, has been the W3C's Web markup recommendation (www.w3.org/TR/xhtml1/) since January 26, 2000. That's more than a year now, but client-side authors and developers of popular authoring software have been slow on the take. Much of the problem lies in the fact that XHTML is misunderstood and not well publicized. Some client-side authors don't see it as having any special advantages, and many critics have claimed that XHTML simply won't be widely adopted. This may well be proven out. XHTML has been almost completely missed by the vast majority of entry- and mid-level professionals.
Ignoring or overlooking XHTML is problematic for the professional developer. Whether it's a useful client-side methodology remains a personal question. However, knowing what it is, why it is, and how it may or may not effectively aid the work you do allows you to make an informed, empowered decision about the technologies you choose to employ.
XHTML: What and Why
In simple terms, writing documents in XHTML means that instead of authoring that old familiar HTML, you are in essence writing XML. XML, in XHTML 1.0, employs HTML as its vocabulary. So elements and attributes are not arbitrary - they're drawn directly from HTML. Similarly, XML syntax rules are applied.
But how does this help client-side authors? The answer is simple. How many of you have honestly paid much attention to the HTML you generate? Some of you will certainly say you do, but most developers - like most Web designers - are guilty of a slapdash attitude toward HTML. It's not your fault. HTML has become sloppy, in part because it's been bent in many directions to accommodate the rapid growth of the Web. And browsers are extremely forgiving of poor markup. Nothing has demanded that you write clean documents because for the most part you haven't had to.
The problems resulting from this are manifold. First, there's no consistency in markup from one HTML author to the next. They've each got their own methodology - some write elements in uppercase, others in lowercase. Quotes are sometimes in use, sometimes not. Looking under the hood at even the most high-end site is usually not a pretty experience. So adding a little syntactical rigor to the mix via XHTML gets authors on the same page, if you'll pardon the pun. That can make for a much smoother workflow among teams.
XHTML 1.0 focuses heavily on getting markup cleaned up. But XHTML has another goal, too, and that's to extend to user agents beyond the Web browser: PDAs, smart phones, set-top boxes, and other alternative and wireless devices. Streamline and strengthen the markup, and you've got a stronger base from which to extend it. That's a logical and rational idea.
Another argument made in XHTML's defense - and it's a controversial one but I buy into it - is that it helps the client-side author who has XML phobia to begin moving into the XML arena via familiar means. I like this argument because as an educator, I've seen proof that it works. Take entry- or mid-level Web authors, teach them XHTML, and suddenly you can also teach them other XML applications: WML, SMIL, SVG. The light bulb goes on because they're operating in an environment that's familiar - HTML. The XML kind of sneaks in via document structure and syntactical rules.
Brass Tacks: XHTML
To gain a better idea of how XHTML 1.0 works, let's first examine its document structure.
Ideally, an XML document begins with an XML declaration:
<?xml version="1.0" encoding="UTF-8"?>But XHTML documents are most often viewed using popular Web browsers, which in some cases will render anything with an XML declaration as text. So for XHTML 1.0, the W3C recommends (but does not require) that the XML declaration be intact. Most Web authors leave it off.
Next comes the DTD, which is required. With XHTML 1.0, you can choose from three public DTDs: strict, transitional, or frameset. Developers working with HTML 4.0 will be familiar with these DTDs and know that the strict DTD uses the most limited set of elements and attributes of the three, basing much of its selection on the idea that presentation and structure must be separate. So you won't find the font element in a strict document. Transitional documents, however, are more flexible, understanding that Web authors must make some accommodations in order to achieve the best interoperability possible. Frameset documents are limited to framesets and can employ elements from strict or transitional DTDs.
For a strict XHTML 1.0 document, you'll use the following declaration:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-strict.dtd">
If you want to write your document in accordance with the transitional DTD, you'll use:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-transitional.dtd">Finally, if you're authoring a frameset, you'll use this declaration:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-frameset.dtd">It's important to remember that there are no exceptions to the rule here. You must declare the proper DTD in your XHTML 1.0 document.
Now it's time to add the namespace to the root. In XHTML 1.0 the root element is html. The root and namespace is also a requirement, and is written as follows:
<html xmlns="http://www.w3.org/1999/xhtml">Listing 1 shows a strict document template using the XML declaration. In Listing 2 I show a transitional document template using a meta workaround for document encoding should you choose not to use the XML declaration.
Get Tough: XHTML Syntax
Now that you've got the document structure down, it's time to explore the syntactical rules that XHTML 1.0 embodies:
- Must be well formed
- Is case specific
- Insists on closing tags for nonempty elements, and termination of empty elements with a trailing slash
- Demands that all attribute values be quoted Let's take a closer look.
Remember, Web browsers are built to forgive. That's one reason they're so bloated; they have to be able to interpret such a wide variety of markup styles. And most browsers will forgive ill-formed syntax. Try the following poorly formed bit of HTML in a browser:
<b><i>An ill-formed bit of HTML</b></i>In common browsers such as MSIE and NN, this markup will appear in both bold and italics. However, if you examine the HTML, you'll see that the tags are improperly nested. If this markup were well formed, the tags would nest properly:
<b><i>A well-formed bit of HTML</i></b>XHTML 1.0 must be well formed to be valid XHTML. A little trick I use to make sure I've nested my tags properly is to draw an imaginary line from the opening tag to its closing companion. If the lines don't intersect, it's properly nested and therefore well formed. Intersecting lines will indicate improperly nested, ill-formed markup.
As you're already aware, XML is case sensitive:
<product>are two different tag sets.
HTML, on the other hand, is not case specific:
<P align="right">XHTML is case specific. In every instance all elements and attribute names must be lower case:
</P> is the same as: <p ALIGN="right">
<p align="right">Note that attribute values can be in upper- or lowercase as necessary to accommodate file names, code strings, and URIs.
XHTML 1.0 adopts the XML method of closing all nonempty elements and terminating empty elements with a trailing slash. In HTML you can write the following:
<li>list item 1
<li>list item 2
<li>list item 3
but in XHTML, you must close the nonempty element:
<ul>One of the more obvious places this occurs is with the paragraph <p> tag. You must close all nonempty elements, no exceptions.
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
If an element is empty (no content), it must terminate. In XML this is done by using a trailing slash as follows:
<br/>But many Web browsers will choke on this method and subsequently not render a page or render it improperly. a workaround is to add a space before the slash. This allows all empty elements to be properly rendered. A few examples:
<img />As with nonempty elements, there can be no exception to the rules. You must terminate the element accordingly.
Quoth the Attribute Value...
One of the more frustrating things about HTML - at least to my eye - is the arbitrariness of attribute value quoting. In HTML it's a now-you-see-it, now-you-don't phenomenon. So you can have:
<img src="my.jpg" border="1" width=400 height=200 alt="company logo">or any combination of attribute value quotations you like. In most instances a browser will properly render the markup whether you've quoted the attribute value or not.
XHTML insists that you quote all attribute values, leaving nothing to chance:
<img src="my.jpg" border="1" width="400" height="200" alt="company logo" />
Not so hard, really
as you can now see, XHTML 1.0 is really no great challenge. Does it mean employing a little more care when creating documents? Yes. Does it mean watching your syntax? Absolutely. But with a few minor adjustments you can have clean markup that works in today's browsers with as close-to-perfect interoperability as HTML and still complies with W3C recommendations.
Advancing Notions: Modularization of XHTML
So what's a little cleanliness, anyway? Critics of XHTML have pointed out that changing habits just to write cleaner documents doesn't provide much incentive. It's time consuming and why on earth would you want to go back and rewrite hundreds, possibly thousands, of Web documents just to comply with a W3C recommendation when those documents function perfectly well? I can't, and won't, argue this point. It's too strong an argument. But if you're interested in moving toward extensibility, want to create consistent documents organization-wide, and want to assist your client-side authors in expanding their markup horizons, working with XHTML makes sense.
While XHTML 1.0 offers little option for extensibility - you've got three set DTDs and a specific namespace - the modularization of XHTML does offer expansion. Modularization of XHTML, which allows for the use of XML DTDs and provides the means to create subsets and extensions to XHTML, takes XHTML 1.0 from its limited place closer to its goal of working for numerous user agents. As of this writing, modularization of XHTML is a Candidate Rec-ommendation of the W3C (www.w3.org/TR/2000/CR-xhtml-modularization-20001020/).
Modularization of XHTML is a decomposition of HTML as we know it today. Instead of lumping markup methods such as managing text, images, tables, and forms, modularization breaks these things into separate modules. Then, using XML DTDs (an implementation of XML schemas is also under discussion), authors can pull together a subset of XHTML using only those modules necessary to accomplish a given task.
If you put modularization in the context of alternative device design, the rationale for XHTML begins to make a lot of sense. Many alternative devices simply don't have the processing, RAM, and video power to handle HTML's original functions. So why have all the overhead? A streamlined markup language using only those modules necessary for the device means faster, customizable delivery to equally streamlined optimized user agents.
A perfect example of modularization exists in XHTML Basic (www.w3.org/TR/xhtml-basic/), a subset of XHTML 1.1, made up of specific modules that apply to wireless devices such as PDAs, smart phones, and smart pagers. These devices are limited in their processing power, so XHTML Basic supplies those modules only for markup that make sense, such as text, links, images, very basic tables, and forms. Frames or scripting demand processing power, so they're left out of the subset. XHTML Basic, at this writing a Proposed Recommendation of the W3C, looks just like XHTML, but of course any element that falls into a module not set forth in the recommendation can't be used in a valid XHTML Basic document. However, you can extend XHTML Basic if you want to. This enables the creation of additional subsets and extensions.
Listing 3 shows a simple XHTML Basic page suitable for display on a small, wireless device such as a PDA. The listing clearly illustrates how XHTML Basic uses the structural elements set forth in XHTML 1.0, only this time the DTD that's declared is for XHTML Basic itself. The namespace is the same, as are the syntactical methodologies.
Bring It On Home
The developer who's empowered with knowledge can make better decisions. Whether you embrace client-side XML in the form of XHTML is up to you. But a careful survey of your needs and directions will help answer the question of whether XHTML will be useful in your unique situation. Being aware of what's happening with XHTML and its goals will keep you at the ready should your circumstances require you to develop not only for the Web of tomorrow, but for the wireless world and beyond.
More and more companies are looking to microservices as an architectural pattern for breaking apart applications into more manageable pieces so that agile teams can deliver new features quicker and more effectively. What this pattern has done more than anything to date is spark organizational transformations, setting the foundation for future application development. In practice, however, there are a number of considerations to make that go beyond simply “build, ship, and run,” which changes ho...
Jun. 25, 2016 09:15 AM EDT Reads: 811
Gartner is now treating algorithms like they are some kind of innovative addition to the modern digital discussion. Presumably the brilliant minds there have some novel insight into algorithms and, yes, the Algorithm Economy that CIOs should sit up and take notice of. Not only are algorithms nothing new, but much of what Gartner is saying about them is obvious. The bigger picture here is that software continues to improve, and enterprises are becoming increasingly software-driven, in part bec...
Jun. 17, 2016 04:07 PM EDT Reads: 787
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound...
Jun. 12, 2016 09:00 PM EDT Reads: 5,123
The Internet of Things (IoT) is growing rapidly by extending current technologies, products and networks. By 2020, Cisco estimates there will be 50 billion connected devices. Gartner has forecast revenues of over $300 billion, just to IoT suppliers. Now is the time to figure out how you’ll make money – not just create innovative products. With hundreds of new products and companies jumping into the IoT fray every month, there’s no shortage of innovation. Despite this, McKinsey/VisionMobile data...
Jun. 12, 2016 02:45 AM EDT Reads: 3,674
NHK, Japan Broadcasting, will feature the upcoming @ThingsExpo Silicon Valley in a special 'Internet of Things' and smart technology documentary that will be filmed on the expo floor between November 3 to 5, 2015, in Santa Clara. NHK is the sole public TV network in Japan equivalent to the BBC in the UK and the largest in Asia with many award-winning science and technology programs. Japanese TV is producing a documentary about IoT and Smart technology and will be covering @ThingsExpo Silicon Val...
Jun. 8, 2016 10:30 PM EDT Reads: 4,598
SYS-CON Events announced today that Men & Mice, the leading global provider of DNS, DHCP and IP address management overlay solutions, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. The Men & Mice Suite overlay solution is already known for its powerful application in heterogeneous operating environments, enabling enterprises to scale without fuss. Building on a solid range of diverse platform support,...
Jun. 8, 2016 06:45 PM EDT Reads: 4,121
Internet of @ThingsExpo, taking place June 7-9, 2016 at Javits Center, New York City and Nov 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 18th International @CloudExpo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world and ThingsExpo New York Call for Papers is now open.
Jun. 8, 2016 03:45 PM EDT Reads: 3,276
SYS-CON Events announced today that Catchpoint Systems, Inc., a provider of innovative web and infrastructure monitoring solutions, has been named “Silver Sponsor” of SYS-CON's DevOps Summit at 18th Cloud Expo New York, which will take place June 7-9, 2016, at the Javits Center in New York City, NY. Catchpoint is a leading Digital Performance Analytics company that provides unparalleled insight into customer-critical services to help consistently deliver an amazing customer experience. Designed...
Jun. 8, 2016 03:00 PM EDT Reads: 3,238
@DevOpsSummit taking place June 7-9, 2016 at Javits Center, New York City, and Nov 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 18th International @CloudExpo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world.
Jun. 8, 2016 01:00 PM EDT Reads: 4,420
Cloud Expo, Inc. has announced today that Andi Mann returns to 'DevOps at Cloud Expo 2016' as Conference Chair The @DevOpsSummit at Cloud Expo will take place on June 7-9, 2016, at the Javits Center in New York City, New York. "DevOps is set to be one of the most profound disruptions to hit IT in decades," said Andi Mann. "It is a natural extension of cloud computing, and I have seen both firsthand and in independent research the fantastic results DevOps delivers. So I am excited to help the g...
Jun. 8, 2016 11:00 AM EDT Reads: 3,698
Korean Broadcasting System (KBS) will feature the upcoming 18th Cloud Expo | @ThingsExpo in a New York news documentary about the "New IT for the Future." The documentary will cover how big companies are transmitting or adopting the new IT for the future and will be filmed on the expo floor between June 7-June 9, 2016, at the Javits Center in New York City, New York. KBS has long been a leader in the development of the broadcasting culture of Korea. As the key public service broadcaster of Korea...
Jun. 8, 2016 10:00 AM EDT Reads: 2,613
SYS-CON Events announced today that Addteq will exhibit at SYS-CON's @DevOpsSummit at Cloud Expo New York, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. Addteq is one of the top 10 Platinum Atlassian Experts who specialize in DevOps, custom and continuous integration, automation, plugin development, and consulting for midsize and global firms. Addteq firmly believes that automation is essential for successful software releases. Addteq centers its products a...
Jun. 8, 2016 09:45 AM EDT Reads: 2,586
In the rush to compete in the digital age, a successful digital transformation is essential, but many organizations are setting themselves up for failure. There’s a common misconception that the process is just about technology, but it’s not. It’s about your business. It shouldn’t be treated as an isolated IT project; it should be driven by business needs with the committed involvement of a range of stakeholders.
Jun. 8, 2016 02:15 AM EDT Reads: 3,653
SYS-CON Events announced today that FalconStor Software® Inc., a 15-year innovator of software-defined storage solutions, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. FalconStor Software®, Inc. (NASDAQ: FALC) is a leading software-defined storage company offering a converged, hardware-agnostic, software-defined storage and data services platform. Its flagship solution FreeStor®, utilizes a horizonta...
Jun. 7, 2016 07:00 PM EDT Reads: 4,238
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo 2016 in New York and Silicon Valley. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place Nov 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 17th Cloud Expo and will feature technical sessions from a rock star conference faculty ...
Jun. 7, 2016 04:30 PM EDT Reads: 5,972
SYS-CON Events announced today that Column Technologies will exhibit at SYS-CON's @DevOpsSummit at Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. Established in 1998, Column Technologies is a global technology solutions provider with over 400 employees, headquartered in the United States with offices in Canada, India, and the United Kingdom. Column Technologies provides “Best of Breed” technology solutions that automate the key DevOps principal...
Jun. 7, 2016 04:15 PM EDT Reads: 3,396
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Jun. 7, 2016 01:00 PM EDT Reads: 2,778
SYS-CON Events announced today that IBM Cloud Data Services has been named “Bronze Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. IBM Cloud Data Services offers a portfolio of integrated, best-of-breed cloud data services for developers focused on mobile computing and analytics use cases.
Jun. 7, 2016 12:30 PM EDT Reads: 2,819
SYS-CON Events announced today that Anexia will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. Anexia offers high-quality customized managed hosting solutions for SaaS and IaaS companies. The company was founded in 2006 in Klagenfurt, Austria. Today, it has additional offices in Vienna, Graz, Munich, Cologne and New York City to serve numerous international customers.
Jun. 7, 2016 11:00 AM EDT Reads: 2,949
SYS-CON Events announced today that Stratoscale, the software company developing the next generation data center operating system, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. Stratoscale is revolutionizing the data center with a zero-to-cloud-in-minutes solution. With Stratoscale’s hardware-agnostic, Software Defined Data Center (SDDC) solution to store everything, run anything and scale everywhere...
Jun. 7, 2016 08:00 AM EDT Reads: 2,957