CHAPTER 3 (Cool web site) WEB VOCABULARIES XHTML Tools You

CHAPTER 3 WEB VOCABULARIES XHTML Tools You can use three kinds of tools to edit your XHTML documents: Simple text editors XML editors XHTML editors Each of these tool types offers different benefits. Let s explore these types in more detail. Text Editors Because XHTML is a text-based format, you can create document markup in text editors, including Notepad on Windows, SimpleText on Macintosh, and Vim on Linux. These editors aren t specifically designed to create XHTML or XML documents, so they have very few features that can assist with authoring. They can t provide information about whether a document is well formed or valid, and they don t provide any type of color-coding for the text. Although they have significant limitations, text editors are often useful because they exist on almost all computers and start up very quickly. The most useful text editors can display line numbers, which are invaluable for tracking down parser errors. XML Editors Many XML editors are designed to work specifically with XML documents. These editors offer many advantages over text editors, not the least of which is automatic color coding for elements within the document. Although not written specifically for XHTML, XML editors can still provide tag completion so your elements close automatically. In addition, XML editors allow you to check that your document is well formed and valid, based on its DTD or XML schema. Some popular XML editors include Altova s XMLSpy: http://www.altova.com/products_ide.html Stylus Studio s XML Editor: http://www.stylusstudio.com/xml/editor/ Topologi s Markup Editor: http://www.topologi.com/products/tme/index.html TIBCO s Turbo XML: http://www.tibco.com/software/business_integration/ turboxml.jsp SyncRO Soft s : http://www.oxygenxml.com/index.html/ Blast Radius XMetal: http://www.xmetal.com/en_us/products/xmetal_author/index.x Wattle Software s XMLwriter: http://www.xmlwriter.net/ Most of these products offer a trial version so that you can test whether they ll suit your needs.
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

CHAPTER 3 WEB VOCABULARIES (Web hosting isp) CHOOSING AN ENCODING

CHAPTER 3 WEB VOCABULARIES CHOOSING AN ENCODING UTF-8 is a Unicode character set that supports the first 128 ASCII characters, as well as additional charac- ters. Documents using only simple ASCII characters can use UTF-8 encoding. The basic ASCII character set doesn t include European characters that include accents, and the numeric values for each character may vary depending on the specified encoding. If you re running an English version of Windows, your default encoding is compatible with ISO-8859-1. This encoding is supported widely, so changing the encoding declaration to ISO-8859-1 allows European characters to display correctly. Encoding rules are often complex. XML supports UTF-8 and UTF-16 encoding by default. UTF-16 is a large character set that includes many Chinese and Japanese characters, among others. In order to have numeric values for all of the characters, it uses two or more bytes for each character, instead of one byte as in UTF-8 and ASCII. Simple text editors may not support encoding other than UTF-8 or ASCII. For more infor- mation about different encoding specifications, visit http://www.unicode.org/. Again, this line tells the browser what type of content the document contains. In the preceding tag, you specify text/html as the document type and ISO-8859-1 as the encoding. If a document contains both the XML declaration and the element, the browser uses the encoding value in the XML declaration. Browsers that don t support the XML declaration use the value. You can also use the HTTP header Content-Typeto specify encoding on the web server. This approach provides the most reliable way to specify the encoding in an XHTML document. You can set the header using any server-side technology. Specifying Language HTML 4.0 and XHTML 1.0 allow you to specify the language for a document or element using the lang attribute. Web browsers can use this information to display elements in language- specific ways. For example, hyphenation may change depending on the language in use. Additionally, screen readers may read the text using different voices, depending on the language specified. The following langattribute specifies the U.S. version of English as the language for the document: You can find out more about which attribute values to use at http://www.w3.org/TR/ REC-html40/struct/dirlang.html. XHTML 1.1 replaces the lang attribute with xml:lang. In addition to XHTML, many other web vocabularies use this attribute from the xml namespace. This makes XHTML much more compatible with other XML applications. If you want a quick refresher on namespaces, see the section, Understanding the Role of XML Namespaces, in Chapter 2.
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

CHAPTER 3 (Multiple domain web hosting) WEB VOCABULARIES In XHTML 1.1,

CHAPTER 3 WEB VOCABULARIES In XHTML 1.1, however, the W3C permits only the idattribute: Again, older browsers expect you to use the name attribute. Because of this, some XHTML 1.1 pages don t work in early browser versions. Nesting Tags The HTML language didn t specify how you should nest tags, so writing something like the following didn t cause an error:

A heading

This doesn t work in XHTML; you need to rewrite the code so the tags close in the correct order:

A heading

Character Encoding Specifying the document encoding is very important, and in some cases required, so that the document displays correctly within different web browsers. Document encoding defines a numeric value for each character. Different encoding schemes sometimes use these values in different ways. Most browsers and computers support ASCII encoding, which assigns values to the 128 most commonly used characters. These characters are compatible across different platforms. If you re using characters with values higher than 128, you must specify the character set so that the browser knows which character to display for a given value. Within XHTML, you can specify the character set that your document is using in several ways, including Using the XML declaration Using the element Using external means You can use any of these methods alone or in combination. Using all methods together ensures that the browser understands the document s encoding, even if it doesn t support that encoding. Again, including encoding declarations may confuse some older browsers. Let s look at each of the methods more closely. Specifying encoding using the XML declaration is very easy, and you ve seen it in the examples in Chapter 1: You can specify encoding in a tag by adding the following element to the section of your XHTML document:
If you are searching for cheap webhost for your web application, please visit
MySQL5 Web Hosting services.

Web server type – CHAPTER 3 WEB VOCABULARIES In HTML, empty

CHAPTER 3 WEB VOCABULARIES In HTML, empty elements appeared like this: In XHTML, empty elements can either appear with an immediate opening and closing tag, such as or in the short form, such as In the short form, you add a forward slash (/) before the closing angle bracket (>). This tells the XML or XHTML parser that the element is empty. Although both forms are legal XHTML, very old browsers have problems reading opening and closing tags for elements that are empty. It s much better to use the short form for empty elements. These browsers also may have difficulty with the forward slash character, so, if you re targeting them, it s also good practice to add a space before the character (
). Attributes In addition to using the proper case for attribute names, you also need to make sure that you write them correctly. In HTML, you could write attribute values without quotation marks. For example, the following was legal in HTML: HTML also allowed you to minimize attributes: Neither of these options is acceptable in XHTML. All attributes must have a value, even if it s blank, and you must enclose all values in matching quotation marks: In the preceding element, you add quotation marks around the attribute value 4. In the

CHAPTER 3 WEB VOCABULARIES This document is (Web hosting billing)

CHAPTER 3 WEB VOCABULARIES This document is saved as marsxhtm1-1.htmwith your resources. As you can see, the XHTML 1.0 strict and XHTML 1.1 documents are almost identical. The major difference is the DOCTYPE declaration that specifies which DTD to use. Although most of the internal reorganization is invisible to you, web browsers can understand the modular structure much more easily. Viewing the document gives almost the same results as shown in Figure 3-1. You could modify the display by changing the stylesheet declarations, exactly as you did with the strict document. The next requirement for XHTML documents is that tags are written in lowercase. Case Sensitivity Unlike HTML, XHTML is a case-sensitive vocabulary. This means that you must write all elements and attributes in lowercase in order to make them valid. Of course, the text within the element and attribute values is not case-sensitive. In HTML, you had to write element names in uppercase. However, this wasn t enforced, so any of the following was allowable: In XHTML, however, the only allowable element construction is Likewise, you must specify attributes using lowercase names. In HTML, any of the following were allowable: In XHTML, all element and attribute names must be lowercase: XHTML is case-sensitive because it s a requirement in XML. Case sensitivity is a major step in internationalization efforts. Although you can easily convert uppercase English characters to lowercase ones, or lowercase characters to uppercase, it s not so easy in other languages. Often there are no equivalent uppercase or lowercase characters, and some case mapping depends on region. Case sensitivity is important in order to allow the specification to use other languages and character sets. Closing Elements In HTML, you didn t need to close some elements, including ,
,


, and . These elements didn t mark up text, so they didn t have a corresponding closing element. In XML, this type of element, referred to as an empty element, may contain attributes but doesn t mark up text. You must close all elements for an XHTML document to be well formed.
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

CHAPTER 3 WEB (Abyss web server) VOCABULARIES Frameset XHTML Documents

CHAPTER 3 WEB VOCABULARIES Frameset XHTML Documents XHTML allows you to write a third kind of document called a frameset document. You use frameset documents with web pages that use frames. Frames are no longer recommended for a variety of reasons, so I ll discuss this topic only briefly. Use the following DOCTYPE declaration to reference a frameset DTD: Note A frameset can include both transitional and strict documents. You can also include one frameset document within another, allowing you to have nested frames. XHTML 1.1 Documents XHTML version 1.1 is a modular version of the XHTML 1.0 strict document type. As it s based on the strict document type, you can t include any presentation elements or attributes; you need to declare these in a stylesheet. Frames, which are often presentational, have been moved to a separate module that is not enabled by default. XHTML is modular, which means that parts of the XHTML document have been divided into separate modules that you can add or remove. When I discuss XHTML Modularization later in the chapter, I ll show you how to mix web vocabularies using different XHTML 1.1 modules. Take a look at this simple XHTML 1.1 document:

Mars Travel
Visits to a faraway place


Your spacecraft

Your spacecraft is the Mars Explorer, which provides the latest in passenger luxury and travel speed.



Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

CHAPTER 3 WEB VOCABULARIES text-align: center; }

CHAPTER 3 WEB VOCABULARIES text-align: center; } hr { width: 100%; } .centered { text-align: center; } .footer{ text-align: center; } The declarations redefine the

,

, and

elements and create classes called centered and footer. I ll explain CSS in more detail in Chapter 5. You can change the look of the web page easily by modifying the CSS. If you apply the same stylesheet to multiple pages, you can update all pages at once by making changes. Figure 3-2 shows the same web page with a modified style sheet. Figure 3-2. A revised presentation of the marsstrict.htm file You can find these files saved as marsstrict2.htm and styles2.css. The stylesheet tells the browser to set the sizes and colors for the

and

elements. It also changes the font for the entire page and defines a color for the

element. The two classes centered and footer inherit the default font and center the text. The footer class uses a smaller font size.
We recommend high quality webhost to host and run your jsp application: christian web host services.

Web servers – CHAPTER 3 WEB VOCABULARIES Strict XHTML Documents

CHAPTER 3 WEB VOCABULARIES Strict XHTML Documents Strict XHTML documents allow you to work with only structural tags, such as headings (

,

,

,

,

,
), paragraphs (

), and lists (

    ,
      ,
      ). All of the presentational elements and attributes, such as align and bgcolor, are removed. The XHTML 1.1 specification has also completely removed presentational markup. In both strict and XHTML 1.1 document types, you should always use stylesheets to control how your document appears in various browsers. Let s look at a sample of a strict XHTML document:

      Mars Travel
      Visits to a faraway place


      Your spacecraft

      Your spacecraft is the Mars Explorer, which provides the latest in passenger luxury and travel speed.


      You can find this file saved as marsstrict.htm with your resources. The strict XHTML document is much shorter and doesn t contain any presentational markup. Instead, it contains a link to a stylesheet called styles.css, which includes the presentational elements. It also replaces the presentational element with the structural element. If you view the file in a web browser, it will look much the same as the first XHTML document. The styles.css stylesheet contains the following presentational elements: h1 { font-weight: bold; font-size: 24px; text-align: center; } h2 { font-weight: bold; font-size: 20px;
      From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

CHAPTER 3 WEB VOCABULARIES You (Web hosting isp) can find

CHAPTER 3 WEB VOCABULARIES You can find this document saved as marstransitional.htm with your code download. The document begins with an XML declaration: XHTML documents don t require an XML declaration, but it s recommended that you include one. If you include the declaration, web browsers can check that the document is well formed. Immediately following the XML declaration, a DOCTYPE declaration tells the web browser exactly what kind of document you re writing: The document root contains a reference to the XHTML namespace: The markup is well-formed XML, but it still contains some presentational information in particular, align and bgcolor attributes. You can download this example, called marstransitional.htm, in the Source Code area of the Apress web site (http://www.apress.com). If you open the file in a web browser, you should see something like the screen shot shown in Figure 3-1. Figure 3-1. The marstransitional.htm page displayed in Internet Explorer The XHTML transitional DTD can be useful if you need to support older browsers. Otherwise, you should try to use the strict or XHTML 1.1 document types.
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

CHAPTER 3 WEB VOCABULARIES XHTML 2.0 At

CHAPTER 3 WEB VOCABULARIES XHTML 2.0 At the time of writing, the W3C had prepared a working draft of the XHTML 2.0 specification (http:// www.w3.org/TR/xhtml2/). This vocabulary removes backward compatibility and all presentation elements in favor of stylesheets. It allows for more flexible organization using sections and headers, and it introduces separator and line elements, as well as navigation lists. It introduces links to every element and overhauls tables and forms. The most recent XHTML specification, XHTML 1.1, became a recommendation in May 2001. It has only one document type to choose from: XHTML 1.1, which is very similar to XHTML 1.0 strict. Each of these four document types has a slightly different set of allowable elements. Choosing the right type of document should be the first step in building your XHTML page. I ll explain each of these document types in more detail. The examples in this chapter show you how to create pages for an imaginary web site called Mars Travel. I ll keep the examples simple so you can focus on the XHTML content. Transitional XHTML Documents You use the transitional document type for web sites that need to work in many different web browsers, because it supports the deprecated elements not allowed in the strict DTD. If you re not ready or able to remove all presentation from your documents, you should use the transitional DTD. Let s look at an example of some transitional markup:

Mars Travel
Visits to a faraway place


Your spacecraft

Your spacecraft is the Mars Explorer, which provides the latest in passenger luxury and travel speed.


XHTML 1.0 Transitional Document


If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.