11.29. HTML- XHTML

发布时间 :2024-02-23 23:00:06 UTC      

XHTML is a HTML written in XML format.

11.29.1. What is XHTML?

  • XHTML refers to Extensible Hypertext markup language

  • XHTML and HTML 4.01 are almost the same.

  • XHTML is a stricter and purer version of HTML

  • XHTML is a HTML defined as a XML application.

  • XHTML is a W3C recommendation released in January 2001.

  • XHTML is supported by all major browsers

11.29.2. Why use XHTML?

Many pages on the Internet contain “bad” HTML.

If you view it in a browser, the following HTML code works perfectly (even if it does not follow the HTML rules):

<html><head><metacharset="utf-8"><title>This is an non-standard
HTML</title><body><h1>non-standard HTML<p>This is a paragraph</body>

XML is a well-formed markup language that must be tagged correctly.

There are some different browser technologies in today’s technology world. Some of them run on computers, while others may run on mobile phones or other small devices. Small devices often lack the resources and ability to explain “bad” markup languages.

So-by combining the strengths of XML and HTML, XHTML was developed. XHTML is a redesigned HTML as XML.

11.29.3. The most important difference compared to HTML:

Document structure

  • XHTML DOCTYPE is mandatory.

  • <html> XML in namespace attribute is mandatory

  • <html> <head> <title> and <body> is also mandatory.

Element syntax

  • XHTML elements must be nested correctly

  • The XHTML element must always be closed

  • XHTML elements must be lowercase

  • An XHTML document must have a root element

Attribute syntax

  • The XHTML property must be lowercase

  • The XHTML attribute value must be enclosed in quotation marks

  • XHTML attribute minimization is also prohibited

11.29.4. <! DOCTYPE…. > is mandatory.

XHTML documents must have XHTML document type declarations (XHTML DOCTYPE declaration).

the xmlns attribute in <html> specifies the XML namespace for the document.

The following example shows an XHTML document with the fewest required tags:

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metacharset="utf-8"><title>document title</title></head><body>document content</body></html>

11.29.5. XHTML elements must be reasonably nested

In HTML, some elements can not be nested within each other, like this:

<b><i>Bold and Italic Text</b></i>

In XHTML, all elements must be reasonably nested within each other, like this:

<b><i>Bold and Italic Text</i></b>

11.29.6. The XHTML element must be related to a closed tag

Example of error:

<p>This is a paragraph<p>This is another paragraph

Correct example:

<p>This is a paragraph</p><p>This is another paragraph</p>

11.29.7. An empty element must contain a close tag

Example of error:

branch:<br>horizontal line:<hr>picture:<imgsrc="happy.gif"alt="Happy face">

Correct example:

branch:<br/>horizontal line:<hr/>picture:<imgsrc="happy.gif"alt="Happy face"/>

11.29.8. XHTML element must be lowercase

Example of error:

<BODY><P>This is a paragraph</P></BODY>

Correct example:

<body><p>This is a paragraph</p></body>

11.29.9. Attribute name must be lowercase

Example of error:

<tableWIDTH="100%">

Correct example:

<tablewidth="100%">

11.29.10. Attribute values must have quotation marks

Example of error:

<tablewidth=100%>

Correct example:

<tablewidth="100%">

11.29.11. Attribute abbreviations are not allowed

Example of error:

<inputchecked><inputreadonly><inputdisabled><optionselected>

Correct example:

<inputchecked="checked"><inputreadonly="readonly"><inputdisabled="disabled"><optionselected="selected">

11.29.12. How to convert HTML to XHTML

  1. Add a XHTML <!DOCTYPE> go to your web page

  2. Add xmlns property is added to the html element.

  3. Change all elements to lowercase

  4. Turn off all empty elements

  5. Modify all attribute names to lowercase

  6. Add quotation marks to all attribute values

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.