Experimenting With XML


Recent versions of Internet Explorer, Opera, and FireFox support XML combined with CSS. The basic rules are as follows:

  1. If you use an element <abc>, you must end it with </abc>. Unlike HTML, no tags may be omitted.

  2. If the element is empty (has no end tag), you must end it with a slash: <xyz/>.

  3. If you use an attribute att="value", make sure you put quotes around the value. Unlike in HTML, all attributes, even simple ones, must be quoted.

  4. Style sheets cannot be in the same file as the XML document. Instead, put a line like this at the top of the XML document (note the two question marks):

     <?xml-stylesheet href="my-style.css"?> 

  • This works the same as <link rel="stylesheet" href= "my-style.css"> in HTML. In fact, as in HTML, you can add "title" and "type" attributes, and you can have multiple alternative styles. But unlike in HTML, you cannot use capital (for example, "HREF" is not correct).

  • The browser doesn't have a built-in style for any XML-based documents, so all elements will be displayed inline. You'll have to use the display property.

But most of all, don't forget that these experiments are not documents that you can share with the world, like HTML. It may seem that you have a meaningful format, with names like "manual," "aircraft," "date," or "chapter," but without proper documentation, nobody can be sure what you mean by them. "Manual" could mean "by hand," and "chapter" might be a sub-group of a club or society. The larger the group of people you want to share this format with, the better the documentation must be.



Cascading Style Sheets(c) Designing for the Web
Cascading Style Sheets: Designing for the Web (3rd Edition)
ISBN: 0321193121
EAN: 2147483647
Year: 2003
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net