Home > Article > Backend Development > XML Getting Started Tutorial: A Detailed Introduction to the XHTM Module
XHTML is a standard recommended by the W3C, which defines an XML-compatible version of HTML. XHTML document is a valid XML document, so the writing format is stricter than HTML.
XHTML is a standard recommended by the W3C that defines an XML-compatible version of HTML. An XHTML document is a valid XML document, so it is edited
XHTML is a standard recommended by the W3C that defines an XML-compatible version of HTML. XHTML document is a valid XML document, so the writing format is stricter than HTML.
XHTML is a standard recommended by W3C, which defines an XML-compatible version of HTML. XHTML document is a valid XML document, so the writing format is stricter than HTML. If you need to convert from an HTML document to an XHTML document, you need to make the following changes:
It is not allowed to omit the closing tag in XHTML, so you need to fill in the missing tags.
Elements need to be nested in the correct order.
All element and attribute names are lowercase.
Attribute values need to be added in quotation marks, such as 0511ef35f46864c22a06c599220d1c6f.
All attributes must have attribute values.
Use physical forms such as & and & lt; and so on.
Make sure the document has a single root element, preferably html.
Empty elements like f32b48428a809b51f04d3228cdf461fa should be changed to fa8fd94cc4b4d9671e4ee513ae2a31d1 or f32b48428a809b51f04d3228cdf461fafa8fd94cc4b4d9671e4ee513ae2a31d1.
Comments should be changed from the form of ba73044524f61eec660057307d02f6d6 to 8cfb60cc12042e443af25dd0030f4295.
The document encoding should be UTF-8 or UTF-16, or add an XML declaration to specify the encoding method of the document.
Non-standard elements need to be removed. Such as: marguee.
Add a DOCTYPE declaration and use PUBLIC to point to one of the three DTDs of XHTML. They are Strict, Transitional and Frameset. Strict is generally used.
Strict (strict), the XHTML format recommended by W3C. Excludes some non-standard elements and attributes, such as applet and center. The declaration method is as follows:
Transitional (transitional), a less strict XHTML format, can use some non-standard elements and attributes, such as applet and bgcolor. The declaration method is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Frameset (frame type), similar to the transitional DTD, allows the use of frame-related elements, such as frameset and iframe. The declaration method is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The root element of the document must have the xmlns attribute, identifying the default namespace http://www.php. cn/.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
The following is an example of a standard XHTML document:
Converting from HTML to XHTML is boring As for the tedious work, there is now an open source tool called tidy that can help us complete most of the work. It is a C program and the usage method is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">xhtml example ...
% tidy --output-xhtml yes test.html test.xml
XHTML 1.1 divides the three DTDs of XHTML into independent modules. We may include or omit certain modules based on actual circumstances.
Presentation Module (presentation module)--->%xhtml-pres.module;, presentation-oriented tags: b, big, hr, I, small, sub, sup and tt.
Edit Module (Edit Module)--->%xhtml-edit.module;, used for modified elements, such as: del and ins.
Bidirectional Text Module (text direction module)--->%xhtml-bdo.module;, used to specify the direction of text reading, such as the bdo element.
Basic Forms Module (Basic Form Module)--->%xhtml-basic-form.module;, used for HTML 3.2 form elements, such as: form, input, select , option and textarea.
Forms Module (form module)--->%xhtml-form.module;, used for HTML 4.0 form elements, such as: form, input, select, option, textarea , button, fieldset, label, legend and optgroup.
Basic Tables Module (Basic Table Module)--->%xhtml-basic-table.module;, basic table elements, such as: table, caption, th, tr and td.
Table Module (table module)--->%xhtml-table.module;, table support for security functions, such as: table, caption, th, tr, td, col , colgroup, tbody, thead and tfoot.
Image Module (image module)--->%xhtml-image.module;, contains the img element.
Client-side Image Map Module (client-side image mapping module)--->%xhtml-csismap.module;, contains map and area elements and supports client-side image mapping The required attribute of the element.
Server-side-Image Map Module (server-side image mapping module)--->%xhtml-ssismap.module;, this module does not add new elements, but for the img element Added an ismap attribute.
The above is the detailed content of XML Getting Started Tutorial: A Detailed Introduction to the XHTM Module. For more information, please follow other related articles on the PHP Chinese website!