Language xhtml. What is the XHTML file extension? All tags and attributes must be written in lowercase

The development of HTML has, in a certain sense, reached a dead end - new tags are no longer needed, since the existing ones are sufficient, and besides, the emphasis in web page development has shifted to styles that expand the possibilities for document design. Naturally, CSS does not replace HTML in any way, but it allows you to use a limited set of tags, and the type of elements, their position and various parameters, set through styles.

A certain limitation of HTML is that it belongs to formal languages, in the sense that tags and their hierarchical structure are strictly described in the specification. Therefore, XML is gaining popularity, with which you can create your own tags and form their structure. The difference between HTML and XML is not only the tags, but also the rules for writing code. When working with HTML, the browser “turns a blind eye” to various minor flaws and shortcomings in the structure or to the fact that an attribute is not specified correctly. Such tricks do not work with XML, so the browser will generate an error stating that the document is not formed correctly.

To teach developers the "right" way of thinking, change their coding style, and bridge the gap between HTML and XML, XHTML was developed as an intermediate step between the two.

XHTML (EXtensible HyperText Markup Language) is intended to replace HTML and is considered its more strict version. In general, the W3C defines XHTML as the latest version of HTML, which will gradually replace it. Whether this will actually be the case, only time will tell.

If we think about some ideal web page code, it can be compared to a program that will not compile until all errors are corrected. The browser acts as a compiler and does not display the document if it does not meet the specification. XHTML, while retaining all the features of HTML, introduces stricter rules for creating pages in order to get closer to the “ideal” code. This allows you to make sites independent of the display device and browser. In other words, the site will be displayed correctly in all modern browsers and platforms such as computers, smartphones, PDAs, netbooks, etc.

In reality, everything is more mundane. Browser developers can't afford to make their brainchild work only with the "correct" code. And all due to the fact that most of the sites in the world simply will not be displayed in such a browser. Both developers and users are to blame for this state of affairs. The former did not provide proper support for the specification in their browsers, and the latter did not bother to follow it.

For these reasons, XHTML 1.x is just a semblance of HTML, but with a stricter syntax, and not a promising markup language that is definitely worth switching to because of its unique capabilities.

The article is based on the original W3C document - XHTML™ 1.1 - Module-based XHTML - Second Edition: W3C Working Draft 16 February 2007. It may change, but will likely replace the existing recommendation - XHTML™ 1.1 - Module-based XHTML.

Strict compliance of documents

Documents that are fully compliant with XHTML 1.1 must meet the following criteria:

  • The root element of the document must be the element.
  • The document root element () must point to an XHTML namespace using the xmlns attribute. The namespace designator for XHTML is "http://www.w3.org/1999/xhtml", i.e. opening html tag there should be a construction like: .
  • The root element may also contain a schemaLocation attribute. The schemaLocation attribute for XHTML is defined as: "http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd" .
  • There must be a DOCTYPE document type declaration preceding the root element. The identifier included in the DOCTYPE declaration must point to the corresponding DTD. This identifier might look like this:
  • Here is an example of a document that complies with XHTML 1.1:

    Virtual Library

    Moved to example.org.

    Note that in this example, an XML declaration is included. An XML declaration like the one above is not required in all XML documents. Authors of XHTML documents are highly encouraged to use the XML declaration in all of their documents. This declaration is required when the XML document's encoding is other than UTF-8 or UTF-16.

    XHTML 1.1 documents should specify the document content type as either text/html or application/xhtml+xml.

    Naturally, user agents (for example, browsers) for their part should also take these recommendations into account.

    XHTML 1.1 document type

    XHTML 1.1 is a fully functional document type with advanced semantics. However, it is not as functionally diverse as the XHTML 1.0 Transitional or XHTML 1.0 Frameset types. Beginning with XHTML 1.1, the document type does not contain deprecated elements contained in XHTML 1.0 or HTML 4 types. Despite these exceptions, or perhaps because of them, the XHTML 1.1 type provides a solid basis for creating new document types in the future, with full support from various agents users.

    The XHTML 1.1 type is composed of the following XHTML modules.

    Structural module body, head, html, title Module for working with text abbr, acronym, address, blockquote, br, cite, code, dfn, div, em, h1, h2, h3, h4, h5, h6, kbd, p, pre, q, samp, span, strong, var Hypertext module a List module dl, dt, dd, ol, ul, li Object module object, param Module of various representation methods b, big, hr, i, small, sub, sup, tt Editing module del, ins Bidirectional text support module bdo Form module button, fieldset, form, input, label, legend, select, optgroup, option, textarea Table module caption, col, colgroup, table, tbody, td, tfoot, th, thead, tr Image module img Image map module client side area, map Server side image map module Ismap attribute included in img Internal events module Event attributes Meta information module meta Scripting module noscript, script Style sheet module style Style attributes module (Deprecated) style attribute Link module link Base module base

    XHTML also uses the Ruby Annotation module:

    Ruby Annotation module ruby, rbc, rtc, rb, rt, rp

    The names of the modules in the list are given according to their definitions in the current version of XHTML Modularization. More detailed information about modules is contained in the document "XHTML Modularization".

    Differences from XHTML 1.0 Strict

    XHTML 1.1 differs from both HTML 4 and XHTML 1.0 technologies. The most significant is the elimination of obsolete elements. In general, there is a strategy to define a markup language from a structural and functional perspective, regardless of the style sheets used for document design.

    The differences can be formulated as follows:

  • The lang attribute has been replaced with the xml:lang attribute.
  • In the a and map elements, the name attribute is replaced by the id attribute.
  • The collection of Ruby elements has been expanded.
  • Thus, the XHTML 1.1 type is not very different from XHTML 1.0 Strict, however, these differences are quite significant and must be taken into account.

    XHTML is an XML-based hypertext markup language that is as close as possible to current HTML standards. XHTML differs from HTML in the strictness of coding. If HTML allowed you to write almost any construction and the browser recognized them correctly, now, with the advent of XHTML, this has become impossible. The latter requires strict compliance with all rules imposed by the W3C. Strict requirements for the design of XHTML code allow you to avoid many errors even at the stage of writing and debugging.

    For HTML adherents, I would like to note that XHTML is a new language that has replaced old HTML. There will be no more new versions of HTML. Eventually all browsers are expected to move to XHTML (obviously maintaining compatibility with older HTML, but nothing more). We would also like to quote from the Russian translation of the XHTML specification from the W3C: “The XHTML family was created with the overall interoperability of user agents in mind. With the help of a new mechanism for profiling user agents and documents, servers, proxies and user agents will be able to transform content in the best possible way. Ultimately, it will be possible to develop XHTML-compliant content suitable for any XHTML-compliant user agent."

    XHTML is compatible with HTML subject to certain rules, a description of which can be found in the standard. This means that even the oldest browsers that understand HTML will also work with XHTML.

    To check the correctness of the XHTML code, there are validators. In addition, user agents that support XHTML will report syntax errors to you if they occur.

    Differences between XHTML 1.0 and HTML. There are several requirements that the developer must fulfill:
    • one of the possible DTDs (Document Type Definition) must be indicated at the beginning of the document:
    • The body of the XHTML document must contain the following tags: html, head, title And body;
    • attribute must be present xmlns in element html;
    • tag and attribute names must be written in lowercase;
    • all attribute values ​​must be enclosed in quotation marks;
    • all tags must be closed; If an element does not have a closing tag, you should add a slash (
      or
      — space for compatibility with older browsers);
    • It is necessary to observe the correct nesting of tags ( text - incorrect; should be written text );
    • it is prohibited to use minimized attributes ( nowrap should be replaced by nowrap="nowrap"); full list of such attributes: checked, compact, declare, defer, disabled, ismap, noresize, noshade, nowrap, multiple, readonly, selected.
    • on the following elements restrictions are imposed on the inclusion of other elements in them:
      • a a;
      • form cannot contain other elements form;
      • label cannot contain other elements label;
      • pre cannot contain img, object, big, small, sub or sup;
      • button cannot contain elements input, select, textarea, label, button, form, fieldset, iframe or isindex;
    • special characters in true meaning must be replaced with their equivalents:
      • & on & ;
      • < on < ;
      • > on > .

    In addition, there are a number of optional recommendations that the developer is not required to follow in version XHTML 1.0, but in subsequent versions of this language the recommendations may develop into requirements:

    • declaration of the XML document at the very beginning of the code before the DTD ( );
    • element following title immediately after opening the tag head;
    • attribute usage id instead of name(name is considered a deprecated attribute);
    • presence of the type attribute in elements of included files (style sheets and scripts);
    • refusal to use the attribute target.

    Here is the minimum code for a correct XHTML page:

    Title Document Contents

    If you paste this code into a file, save it as "file.html" and open it through a web server, then all the information will be received by the client as >text/html*/-->

    This syntax is universal. This code will work correctly for both .

    The best and the most simple solution there will be a connection external files style sheets and scripts. In XHTML this is done in the same way as in HTML:

    If you have installed on your computer antivirus program You can scan all files on your computer, as well as each file individually. You can scan any file by right-clicking on the file and selecting the appropriate option to scan the file for viruses.

    For example, in this figure the file my-file.xhtml is highlighted, then you need to right-click on this file and select the option “scan with AVG” in the file menu. When you select this option, it will open AVG Antivirus, which will perform the check this file for the presence of viruses.


    Sometimes the error may occur as a result of incorrect installation software, which may be due to a problem encountered during the installation process. This may prevent your operating system from associating your XHTML file with the correct application software, influencing so-called "file extension associations".

    Sometimes a simple reinstallation Internet Explorer may solve your problem by properly linking XHTML to Internet Explorer. In other cases, problems with file associations may result from poor programming of the software by the developer, and you may need to contact the developer for further assistance.


    Tip: Try updating Internet Explorer to latest version to make sure you have the latest patches and updates installed.


    This may seem too obvious, but often the XHTML file itself can be the cause of the problem. If you received the file via an attachment Email or downloaded it from a website and the download process was interrupted (such as a power outage or other reason), the file may become corrupted. If possible, try to get new copy XHTML file and try to open it again.


    Caution: A damaged file may cause collateral damage to a previous or existing malware on your PC, so it is very important to keep an updated antivirus running on your computer at all times.


    If your XHTML file is associated with hardware on your computer, you may need to update the device drivers associated with that hardware in order to open the file.

    This problem is usually associated with media file types that depend on the successful opening of hardware inside the computer, e.g. sound card or video cards. For example, if you are trying to open an audio file but cannot open it, you may need to update your sound card drivers.


    Tip: If you receive an error message related to .SYS file when you try to open an XHTML file, the problem may likely be due to corrupt or outdated device drivers that need to be updated. This process can be made easier by using driver update software such as DriverDoc.


    If the steps did not resolve the issue and you are still having trouble opening XHTML files, it may be due to a lack of available system resources. Some versions of XHTML files may require a significant amount of resources (e.g. memory/RAM, computing power) to open properly on your computer. This problem occurs quite often if you are using a fairly old computer. Hardware and at the same time a much newer operating system.

    This problem can occur when the computer has difficulty completing a task because operating system(and other services running in the background) may consume too many resources to open an XHTML file. Try closing all applications on your PC before opening the Extensible Hypertext Markup Language Document. Freeing up all available resources on your computer will provide the best conditions for attempting to open an XHTML file.


    If you've followed all the steps above and your XHTML file still won't open, you may need to perform a hardware update. In most cases, even when using older versions of hardware, the processing power can still be more than sufficient for most user applications (unless you're doing a lot of CPU-intensive work, such as 3D rendering, financial/scientific modeling, or intensive multimedia work) . Therefore, it is likely that your computer does not have enough memory (more commonly called "RAM" or RAM) to perform the file open task.

    XHTML Stands for ExtensibleHypertext Markup Language and in Russian - Extensible Hypertext Markup Language. Please note that it is not extended, but expandable. This means that this language

    It is still being replenished (expanded). So what is XHTML? The main difference between XHTML and HTML is the way the document (web page) is processed. It is worth introducing one more definition. Parser is a program or part of a program that performs parsing. It is also called a parser. To put it even simpler, then this program performs an analysis of the entire structure of the page, the entire page code. In HTML, when an error was found, it was corrected during analysis, which required additional time - the browser needed to understand what the author (developer) wanted to write. For example, if there was an error in any tag, it was simply displayed with the rest of the text.

    Another difference is that all elements must be closed, and single tags must be followed by a /, for example:
    . I will write a separate large article about tags, and I will also write about each tag separately. The encoding in XHTML is UTF-8 (the most common now), while in HTML ISO 8859-1 was used.

    • The first common mistake is to indicate in the tag the relative path to the DTD file copied from the site www.w3.org, "DTD/xhtml11.dtd". In place of this you need to write the full path "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" .
    • violation of the principle of closing all elements without exception. XHTML language, unlike the same HTML, obliges to close all elements, including those that do not have a closing tag, such as, for example,
      .
    • The absence of quotation marks when describing attribute values ​​is unacceptable. For example design
      Internet