[Top]
More advice for the full screen mode.
   
Sivut toimivat riittävän hyvin MS IE 4.0+, Opera 5.x+, Netscape 6.0+/ vast. Mozilla ja Konqueror 3.x selaimilla. Yleisesti ottaen sivut toimivat parhaiten uusimmilla Opera selaimilla. Sivujen toimivuus vanhemmissa selaimissa on heikko, erityisesti Netscape 4.x kohdalla.

I list below all topic groups, which I have done according to subjects, which they handle. You can return to this topic group by using this menu and the link Table of topic groups on the top of the each page.
 
 
Search:
[Help]

XML and XHTML

Topics

XML

XML has been born from the special needs of commercial companies. HTML-elements are limited and they don't often describe the matter itself. In XML documents can use HTML-elements or create own elements, which are self-describing like <BOOK-CONTENTS>.

Would you like to create XML-documents?

Especially the purpose of Microsoft is to create large world-wide databases, which have the possibility to use elements and element patterns as searching criterion. Also mathematical science, chemistry could use own elements. Because there is no limits of possible elements, XML is extensible (eXtensible M arkup Language).

HTML documents have predefined presentations to elements. XML elements don't have any default presentation. Undefined XML element is just nothing! A way to give presentation to XML elements is CSS. If XML-documents use same elements as HTML-documents, the same CSS-file can be used in HTML and XML-documents (I made extra page about this matter[S]).

Another way is XSL (eXtensible Stylesheet Language), which have more possibilities to affect to the structure of XML-document. Microsoft favors it. It gives the possibility to set elements in another order with more powerful way than CSS. It is however remarkable, that favoring XSL is partially derived from the truth that the CSS implementation in Microsoft Internet Explorer is not ready. CSS can't give proper presentation to XML document using MS IE browsers.

If the implementation would be better, the case would be different. Shortly - the CSS-implementation of MS IE doesn't fulfil XML-requirements. It is possible to create good presentation to XML documents for example for Netscape 6.x+ and Opera 4.x+ browsers. I handle MS IE 5.5+ in extra page[S]).

The compatibility of XML-documents towards HTML 3.2 capable browsers is depending of the author of the XML document. In the worst case XML-document is to old browsers stick text with some special encoding (read the footnote 1[S][Pw], if you want to know, what I mean with special encoding) - in practice impossible or extremely difficult to read. In fact the author can create his own HTML resemblance language - XML is ideal language to "do-it-yourself " people! XML-document can however be quite readable to old browsers, when all or most elements are same as in the HTML-documents (they don't need however to behave at the same way in XML-capable browsers).

XHTML

An XHTML (eXtensible Hyper Text M arkup Language) document is a special XML-document, which use primary the same elements as HTML-documents. It can be declared either as a HTML or XML document. But XHTML-document must always made according to XML rules, which are in some matters more strict than in HTML documents. First of all documents must be well-formed - it is not allowed to make as much encoding errors as before! Between ordinary HTML-documents and XHTML-documents are for example following differences:

 
  1. Documents might have the XML-declaration (<?xml ...?>), but it is not required. HTML-documents don't have at all corresponding declaration. Like HTML-documents XHTML-documents must declare as XHTML-document with standard DTD-information, for example <!DOCTYPE HTML PUBLIC "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/"/dtd/transitional.dtd"> (in the strict DTD-document type is a tiny error - read the footnote 2[S][Pw]).

  2. The root element is always html and there is XML namespace declaration: <html xmlns="http://www.w3.org/TR/xhtml1/">.

  3. All HTML-elements and attributes are written in lower case characters. All elements are in XML-documents case sensitive. This kind of combination is illegal in XML-documents even it is valid in HTML-documents: <BODY>... </body>. If attributes have standard values, they must write with lowercase characters (for example align="center").

  4. All attribute values including those, which have only numeric values must be inside quotations. The attribute width=3 is not valid in XHTML-document. It must be width="3".

  5. Values for id-attributes are case sensitive (in addition it is worth to know that if for example for an A element have been set an identifier it is not enough to set just a name-attribute but instead or in addition of a name-attribute must use also an id-attribute, which has exactly the same value as the name-attribute).

  6. Elements are divided more strictly into normal and empty elements. Empty elements don't need in ordinary HTML-documents any kind of closing tags. This is not however valid procedure in XML-documents. Also empty elements needs some kind of clear termination. The termination is marked before the > -sign, for example <br /><img scr="image.gif" /> (when before the forward slash (/) is left a single space, all browsers can read the tag correctly). Then the opening tag is at the same time the termination tag. In HTML-document elements P and LI don't need necessary termination tags even if they are allowed (it is even recommended to give the termination tag for the element P - I use always termination tags to this element). This is illegal in XHTML-documents. It is also illegal to use in XML-documents <p />      or <li />, because those elements are not as their nature empty elements.

Below is an example of very simple XHTML-document ([M][S][Pw]):

<!DOCTYPE HTML PUBLIC "-//w3c//dtd xhtml 1.0 transitional//en"
http://www.w3.org/TR/xhtml1/"/DTD/transitional.dtd">
<html xmlns="http://www.w3.org/TR/xhtml1/">
   <head> 
      <meta name="keywords"
      content="Opera,Mozilla,Netscape,Internet Explorer,CSS" />
      <title>An example XHTML document</title>
   </head>

   <body>
      <h1>The main header</h1>
      <br />
      <p>Text.</p>
      <p>Text.</p>
      <blockquote>Text inside a block quote</blockquote>
      <ol>
         <li>Text in a list.</li>
         <li>Text in a list.</li>
      </ol>
</body>
</html>

Pages of this CSS-guide are today XHTML 1.0 documents except model pages. It is easy to convert HTML-files into XHTML-files using the HTML Tidy utility, which is HTML-Kit (freeware). If you want to use same CSS-files in HTML, XHTML and XML-document, it is sensible to write names of elements always with lower case characters. I have tried to create my examples so, that they could be used also in XHTML-documents. To use scripts is however problematic, but I have used them like in normal HTML-pages.

W3C: XHTML 1.0 (4.8 Script and Style elements and C.4 Embedded Style Sheets and Scripts), Namespaces in XML[Pw].
Other sites: HTML-Kit Home Page[Pw]
.

The next page handle basic methods, how to use style sheets.

[Top]
 

Footnote 1. DTD-files, which are used with XML-files are primary created according to the same principles as in HTML-files. Own common entities[S] (commonly abbreviations) must be declared. It is recommended to use CDATA sections[S] instead of common entities to express special encoding on the screen. If the author creates his own entities, the document is at some parts an-readable to old browsers. Old browsers can't know what own entities mean.

Footnote 2. In the XHTML 1.0 Strict DTD-file is an erroneous parameter entity declaration ( ), because it doesn't match to the attribute list of element A like it does in the DTD-file for HTML 4.0 loose (target %FrameTarget; #IMPLIED -- render in this frame --).

[Top]

   
Copyright Tapio Markula 1999-2003, Salo, Finland
(table of topic groups, E-mail - add Tapio.Markula)
( tapio.markula@nic.fi)
Not into the public use without my permission. If you want to use my pages at some way read the copyrights.
Get Expression!

An editor for creating standard-compliant HTML and XML documents. Documents of this site have in most cases checked with HTML Tidy by Dave Ragget (W3C) and randomly with the official MarkUp Validation Service of W3C. The syntax of most pages in this site should conform with the XHTML 1.0 specification of W3C. Test this page!
Information about browsers, which render or print this site best.
[Get Opera!] [Get Mozilla!]
CSS-guide has been last edited 07.08.2004