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

Материал из FictionBook
Перейти к: навигация, поиск
 
Строка 1: Строка 1:
 
{{Надо перевести на английский}}
 
{{Надо перевести на английский}}
 
{{Toc-Right}}
 
{{Toc-Right}}
XML-язык разметки, с жестко заданными правилами (все теги должны быть закрыты и т.п.). В пределах этих правил вы получаете полную свободу (собственные имена тегов и т.п.) XML прост в создании и обработке.
+
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? ==
+
== Why do I need XML? ==
  
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.  
  
При работе с FictionBook вам, вероятнее всего, удастся избежать столкновения с XML-кодом, но понимание смысла своих действий будет полезным.
+
== What is XML?  ==
  
== Что есть 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?  ==
  
== Что отличает XML от других языков разметки? ==
+
Its ease in creation and processing of files. XML was formulated as a format equally easily handled by program, browser and man.
  
Его простота в создании и обработке. XML задуман как формат, одинаково легко обрабатываемый программой, браузером и человеком.
+
This ease is provided with several features of XML:
  
Эта простота обеспечивается несколькими особенностями языка XML:
+
# Intuitive ease and clarity;  
# Интуитивной простотой и понятностью;
+
# Strictness.
# Строгостью.
+
  
=== Интуитивная понятность ===
+
=== Intuitive clarity ===
Вы открываете пришедший неизвестно откуда файл и понимаете, что к чему. Например, вот файл с описанием модуля PERL:
+
 
 +
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">
 
  <SOFTPKG NAME="DBD-mysql" VERSION="1,2212,0,0">
Строка 38: Строка 39:
 
  </SOFTPKG>
 
  </SOFTPKG>
  
(файл взят с сайта activestate)
+
(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.
 +
 
 +
=== Intuitive clarity ===
 +
 
 +
# XML documents like in HTML are marked by tags - the markers between brackets <> (<body>, <table>). But unlike HTML, the XML document can use any tag (such as <my_cool-TAG>).
 +
 
 +
# 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).
 +
 +
# 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.
  
Я открыл этот файл и исправил одну строку (<CODEBASE>). Мне не потребовалось для этого читать мануалы или скачивать программы-анализаторы. Любой документ XML должен соответствовать этому принципу.
+
# Tags in XML are case-sensitive. That is <i> and <I> is not the same in XML.  
  
=== Строгость ===
+
# Документы XML помимо корректной вложенности тегов (well-formed, правильный XML) имеет еще одну степень структурированности. Можно задать, например, что тег <I> будет встречаться только внутри тега <PARAGRAPH>, а внутри тега <PARAGRAPH> может находиться только текст и тег <I>. Любой документ, в котором это правило будет нарушено, считается невалидным и при его обработке никаких гарантий не дается - в лучшем случае будет выдана ошибка. Можно задать теги, которые должны обязательно присутствовать в конкретном месте документа. Можно задать набор тегов, только один из которых может быть использован внутри тега, или указать, какой тег за каким должен следовать.
  
# XML документы, как и документы html, размечаются '''тегами''' - маркерами, окруженными знаками <> (<body>, &lt;table&gt;). Но в отличие от html, в документе xml можно использовать любые теги (типа <мой_кульный-тег>).
+
# 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.  
# Разметка в документе XML используется для выделения '''структуры''' и только для этого. '''Представление''' документа полностью выносится из документа и обрабатывается отдельно. Для любого документа XML можно создать бесконечное множество представлений (для этого используются [http://xml.nsu.ru/xml/xml_display.xml CSS] и [http://xml.nsu.ru/xml/xml_xsl.xml XST-стили]).
+
 
# Структура документа XML жестко задана и не может быть нарушена. Например, такое сочетание тегов, как <nowiki><I> <B></I> </B></nowiki> является допустимым (хотя и ошибочным) в html и будет адекватно отображено в браузере (например). В XML же такое сочетание тегов вызовет сообщение об ошибке, и документ обработан '''не будет'''. Любой вложенный тег должен быть закрыт прежде, чем родительский.
+
# Теги в XML чувствительны к регистру. То есть <nowiki><i> и <I></nowiki> в XML - не одно и то же.
+
# Документы XML помимо корректной вложенности тегов (well-formed, правильный XML) имеет еще одну степень структурированности. Можно задать, например, что тег <nowiki><I></nowiki> будет встречаться только внутри тега <PARAGRAPH>, а внутри тега <PARAGRAPH> может находиться только текст и тег <nowiki><I></nowiki>. Любой документ, в котором это правило будет нарушено, считается невалидным и при его обработке никаких гарантий не дается - в лучшем случае будет выдана ошибка. Можно задать теги, которые должны '''обязательно присутствовать''' в конкретном месте документа. Можно задать набор тегов, только один из которых может быть использован внутри тега, или указать, какой тег за каким должен следовать.
+
  
== Ну и зачем все это? ==
+
== Well and what is all this for? ==
  
Благодаря такой строгости достигается легкость поддержки XML в различных программах и надежность получаемых данных. Программная обработка документов XML является довольно тривиальной задачей, будь то отображение, приведение к другому стандарту (например, преобразование в html) или поиск и анализ информации.
+
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.  
  
Здесь изложены азы, необходимые для работы с FictionBook, за более подробной информацией можно обратиться к специализированным сайтам или литературе.
+
Such are the elements necessary for work with FictionBook. For more detailed information refer to specific web sites or literature.  
  
'''''Дмитрий Грибов'''''
+
'''''Dmitry Gribov'''''
  
== Так же смотрите: ==
+
== See also: ==
  
 
[http://www.w3.org/XML/1999/XML-in-10-points XML in 10 points от W3C].
 
[http://www.w3.org/XML/1999/XML-in-10-points XML in 10 points от W3C].
  
Информация о текущем состоянии [http://www.w3.org/XML/ стандарта] на сайте W3C.
+
The information on a current state of the XML [http://www.w3.org/XML/ standard] on W3C site.
 
[[Категория:Arts]]
 
[[Категория:Arts]]

Версия 12:49, 27 июня 2006

Ошибка создания миниатюры: Не удаётся сохранить эскиз по месту назначения
Внимание! Attention!
Содержимое этой страницы надо перевести на английский язык.

Contents of this page it is necessary to translate into English language.

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.

Intuitive clarity

  1. XML documents like in HTML are marked by tags - the markers between brackets <> (<body>, ). But unlike HTML, the XML document can use any tag (such as <my_cool-TAG>).
    1. 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).
    1. The structure of XML documents is rigidly determined and cannot be broken. For example, such combination of tags as </I> 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.
    1. Tags in XML are case-sensitive. That is <i> and <I> is not the same in XML.
    1. Документы XML помимо корректной вложенности тегов (well-formed, правильный XML) имеет еще одну степень структурированности. Можно задать, например, что тег <I> будет встречаться только внутри тега <PARAGRAPH>, а внутри тега <PARAGRAPH> может находиться только текст и тег <I>. Любой документ, в котором это правило будет нарушено, считается невалидным и при его обработке никаких гарантий не дается - в лучшем случае будет выдана ошибка. Можно задать теги, которые должны обязательно присутствовать в конкретном месте документа. Можно задать набор тегов, только один из которых может быть использован внутри тега, или указать, какой тег за каким должен следовать.
    1. 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.


    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.