Eng:The XML Basics — различия между версиями

Материал из FictionBook
Перейти к: навигация, поиск
(Well and what is all this for?)
Строка 1: Строка 1:
 
{{Toc-Right}}
 
{{Toc-Right}}
 +
[[Краткий курс XML|Russian]]
 +
 
XML is a markup language with rigidly set rules (all tags should be closed, etc.). Within the limits of these rules you have total freedom (specific names of tags, etc.). XML is simple in development and processing.  
 
XML is a markup language with rigidly set rules (all tags should be closed, etc.). Within the limits of these rules you have total freedom (specific names of tags, etc.). XML is simple in development and processing.  
  

Версия 14:38, 27 июня 2006

Russian

XML is a markup language with rigidly set rules (all tags should be closed, etc.). Within the limits of these rules you have total freedom (specific names of tags, etc.). XML is simple in development and processing.

Why do I need XML?

XML files can easily be used by many programs. The file can be displayed, transformed, catalogued very simply, etc. Working with FictionBook, you most likely will avoid encounter with the XML code but understanding of the essense of your actions might be useful.

What is XML?

It is a universal markup language. There are others but currently it may be considered as the most promising.

What distinguishes XML from other markup languages?

Its ease in creation and processing of files. XML was formulated as a format equally easily handled by program, browser and man.

This ease is provided with several features of XML:

  1. Intuitive ease and clarity;
  2. Strictness.

Intuitive clarity

You open an unknown file thet has arrived fron somewhere and understand what is what. For example, here is a file with the description of a PERL module:

<SOFTPKG NAME="DBD-mysql" VERSION="1,2212,0,0">
  <TITLE>DBD-mysql</TITLE>
  <ABSTRACT>MySQL driver for the Perl5 Database Interface (DBI)</ABSTRACT>
  <AUTHOR>Jochen Wiedmann (joe@ispsoft.de)</AUTHOR>
  <IMPLEMENTATION>
    <DEPENDENCY NAME="DBI" VERSION="1,08,0,0" />
    <DEPENDENCY NAME="Data-Dumper" VERSION="0,0,0,0" />
    <DEPENDENCY NAME="Data-ShowTable" VERSION="0,0,0,0" />
    <OS NAME="MSWin32" />
    <ARCHITECTURE NAME="MSWin32-x86-multi-thread" />
    <CODEBASE HREF="D:/My_WWW/MySQL/DBD-mysql-1.2212.x86.tar.gz" />
  </IMPLEMENTATION>
</SOFTPKG>
(The file was taken from ActiveState) 

I opened this file and corrected one string (<CODEBASE>). To do this I did not have to read manuals or download analyzer programs. Any XML document should meet this principle.

Strictness

  1. XML documents are marked by tags like in HTML - by markers between brackets <> (<body>, ). But unlike HTML, the XML document can use any tag (such as <my_cool-TAG>).
  2. Markups in XML documents is used to demarcate the structure, and merely for this purpose. The document description is completely taken out of the document and handled separately. For any XML document it is possible to create infinite set of descriptions (CSS and XST styles are used for this purpose).
  3. The structure of XML documents is rigidly determined and cannot be broken. For example, such combination of tags as <I> <B> </I> </B> is acceptable (although incorrect) in HTML and will be adequately displayed in a browser for example. However in XML such combination of tags will cause an error message, and the document will not be handled. Any nested tag should be closed before its parent.
  4. Tags in XML are case-sensitive. That is <i> and <I> is not the same in XML.
  5. XML documents beside a correct nesting of tags (well-formed, correct XML) has one more degree of structuredness. It is possible to declare, for example, that the tag <I> will appear only within <PARAGRAPH>, and <PARAGRAPH> can only include text and the tag <I>. Any document in which this rule will be broken, is considered invalid, and at its processing assumes no guarantees - at the best an error will be issued. It is possible to declare tags which should undoubtedly be in a specific place of the document. It is possible to define a set of tags of which only one can be used inside of a tag, or specify what tag should follow what.

  6. Well and what is all this for?

    Due to such strictness, ease of XML support by various programs and reliability of data is achieved. Digital processing of XML documents is a quite trivial task, whether it be mapping, coercion to another standard (for example, conversion to HTML) or search and analysis of information.

    Such are the elements necessary for work with FictionBook. For more detailed information refer to specific web sites or literature.

    Dmitry Gribov

    See also:

    XML in 10 points от W3C.

    The information on a current state of the XML standard on W3C site.