XML should
be easy to use on the Internet
Ease of use on the Internet was XML's first design goal and was achieved by developing XML to use existing Internet protocols. XML has been simplified to the degree that Internet applications can process it as quickly as they would process HTML.
support a wide variety of applications
XML should support a wide variety of applications. This will allow applications that work outside the World Wide Web, such as databases and word processors, to be developed to support XML.
be compatible with SGML
XML should be compatible with SGML. This gives it the flexibility of a generalized markup language and ensures that it conforms to a widely accepted standard.
keep optional features to a minimum
XML should keep the number of optional features to an ideal minimum of zero. Optional features would lead to compatibility problems when documents are shared. Having no optional features results in greater compatibility between users.
be fully legible and reasonably clear, and
XML documents should be fully legible and reasonably clear. They also have definable tags that enable developers to use meaningful names for tags. So you should be able to read XML code with a text editor rather than a browser.
consist of plain ASCII text
XML documents should consist of plain ASCII text – like HTML – so that anyone can create or edit them in a text editor.
Question
Identify the features of XML.
Options:
1. An XML document requires a DTD to function 2. It allows you to create your own tags
3. XML is a simplified version of SGML 4. Documents do not have to be well formed
Answer
84
Option 1: Correct. The DTD describes the meaning and function of each tag in an XML document.
The XML document will not function without it.
Option 2: Correct. XML is extensible, which means that you can define your own tags for describing data.
Option 3: Correct. XML is a less complex version of SGML that was developed for the web.
Option 4: Incorrect. Documents must be well formed with tags closed, elements correctly nested, and elements and attributes in lower case.
Correct answer(s):
1. An XML document requires a DTD to function 2. It allows you to create your own tags
3. XML is a simplified version of SGML
Extensible HTML, known as XHTML, is a combination of HTML and XML. It takes the features of HTML and combines them with the data description abilities of XML. It is written using XML and is designed to replace HTML. XHTML documents have to be very well-formed. This means that, unlike HTML, XHTML documents can be parsed using standard XML parsers.
The basic structure of an XHTML page includes a Document Type Declaration, or DOCTYPE.
This validates the document as a valid XHTML document through a Document Type Definition, or DTD.
This is an example of the structure of a DOCTYPE. The first line is an XML declaration, which includes the version of XML being used, the encoding scheme, and the DTD location. The DTD follows the XML declaration, and the DTD is followed by the namespace.
Code
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>An XHTML 1.0 Strict standard template</title>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
</head>
<body>
<p> ... Your HTML content here ... </p>
</body>
</html>
85
The namespace uniquely identifies duplicate elements that have differing values, or can be used to identify different languages used in the document. The namespace is followed by the
character data, or CDATA, which is the content. If the content is code, it is referred to as parsed character data, or PCDATA.
Finally, after the CDATA and PCDATA, the document contains white space. XHTML ignores white space in much the same way that HTML does, except that white space is included when inserted within quotation marks.
3. Web content for wireless devices
Wireless Application Protocol, known as WAP, is an open specification designed to enable mobile devices to access the Internet. Such devices include cellular phones, personal digital assistants, known as PDAs, and pagers.
Using WAP means that these devices can be used to read and send e-mail and access web sites. However, viewable content may be reduced due to hardware limitations in many mobile devices.
WAP 2.0 was released in 2002 and is a reworked version of WAP that uses a cut-down version of the XHTML that has end-to-end HTTP.
Mobile devices make use of XHTML Mobile Profile, known as XHTML MP, which is the markup language as defined by WAP 2.0.
The Wireless Markup Language is the language that was initially used to allow a WAP browser to display text sections of web pages on cell phones and PDAs via wireless access. Referred to more commonly as WML, it is based on XML and is used to specify user interface and content for all narrowband, WAP-enabled devices. WML is an industry standard that has been optimized for small displays.
However, WML has some disadvantages:
limited computational power
WML's limited computational power is a problem. WMLScript was developed to address this issue and is based on JavaScript technology. When integrated with WML, it creates a more powerful programming interface. However, when compared with other languages, WML and WMLScript are still limited in computational power.
constrained by device limitations, and
Small display size is a major constraint of wireless devices. The development of WML may be hindered by the limitations of the wireless devices available.
slow connection speeds
86
The slow download times can lead to prohibitively expensive call charges, which can effect the uptake of WAP services.
WML is now not widely used and has largely been replaced by XHTML Mobile Profile code. This is an improvement on HTML and WML that contains some attributes of both preceding
languages. This code contains a start tag, such as an element name and its attributes, then the element attributes, and finally a closing tag.
Code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN"
"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>XHTML MP Example</title>
</head>
<body>
<p>Example of an XHTML MP document.</p>
</body>
</html>
This is the syntax for using XHTML MP code.
Code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN"
"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>XHTML MP Example</title>
</head>
<body>
<p>Example of an XHTML MP document.</p>
</body>
</html>
Syntax
<element attribute="value">element content</element>
XHTML MP contains support for many modules, including text, hypertext, list, forms, basic tables, image, objects, meta information, scripting, style sheet, style attribute, link, and base.
Partial support is available for presentations, intrinsic events, and legacy.
87
XHTML MP also has a module known as Text Input Modes that deals with all the different kinds of input available when using mobile devices.
Many HTML module elements are supported within XHTML MP. However, tables should be used minimally because support for them in mobile browsers is not good.
Some important points to remember when writing XHTML MP code are that
documents must be well formed
tags must be closed
elements must be properly nested
elements and attributes must be in lowercase
attribute values must be enclosed with quotes
attributes can't be minimized, and
XHTML entities must be handled properly
Question
What are the advantages of XHTML MP?
Options:
1. Many HTML module elements are supported 2. Partial support is available for presentations 3. Partial support is available for hypertext 4. It has limited computational power
Answer
Option 1: Correct. Most HTML module elements are supported by XHTML MP, although tables can be tricky and should be used sparingly.
Option 2: Correct. XHTML MP provides partial support for presentations, intrinsic events, and legacy.
Option 3: Incorrect. XHTML MP provides full support for hypertext.
Option 4: Incorrect. Limited computational power is a disadvantage of WML.
Correct answer(s):