Home
Home Page
XML on the screen of a browser
Interaction with life cycle of page
How to overtake competitors and at once to do{make} liderskie pages
Adjustment of parameters PHP in php.ini
KHehshirovanie passwords in PHP
Total Automation of Reception of payments on a site
Object-oriented programming, classes in PHP
Abstract classes and interfaces
The module of definition of a geographical position on IP - mod_GeoIP
Conclusion of messages to the user in webs - applications.
Manipulation date on PHP
The truth about Sessions
Realization of patterns on PHP.
Protection against a spam on a site
Imitation of files and directories
Door in protection: the post web - interface
Safety of search engines in the corporate environment
CHPU and PHP (revisited)
Links
 
 

XML on the screen of a browser

Abbreviation XML recently, as they say, " on hearing ". Support XML is promised by manufacturers of new browsers, XML-editors are developed, even more often it is possible to hear about next improbable applications XML. What became the reason of occurrence and so fast distribution of this technology?


The majority of experts are almost unanimous that HTML badly copes with the increased requirements to published in Web to documents and it is necessary for him to search for replacement urgently. For a role of the basic language of performance of the information it is considered one of the first candidates XML.


From the moment of occurrence XML has passed very few{not enough;very poorly} time, however he very quickly became popular. Many have already chosen it  as the tool for job and, similar, do not repent in sodejannom.


Universal remedy of the description of the data


Notwithstanding what XML often consider{examine} as alternative HTML, in the list of applications of the given language seldom enough there are links to the Web-sites using XML for a marking of documents. Here messages on the specialized languages of the description of the data constructed on his  basis obviously are in the lead.


To one of first such languages became AML (Astronomical Markup Language), created for an exchange not only parameters of heavenly objects, but also clauses{articles}, tables, images, data on the personnel, in a word, any information necessary for an observatory in a daily life. Astronomers were followed also by other scientists. For performance of the mathematical data and their transfers on a network have been developed MathML (Mathematical Markup Language). The whole series of similar products was created by biologists: SBML (Systems Biology Markup Language), BIOML (BIOpolymer Markup Language), BSML (Bioinformatic Sequence Markup Language), etc.


Jobs and in other areas are actively conducted. Project VHG (Virtual HyperGlossary) assumes construction of system of the interconnected dictionaries, called to form " the terminological environment " for various documents. Language of the description vector schedules VML (Vector Markup Language) should provide support of sets of the images incorporated by means of links. The languages specially intended for job with archives, for construction of training systems are created also. This list can be continued very for a long time. Whether it is necessary to speak, what in a basis of all listed languages all lays the same XML?


Such abundance of applications not casually. In fact a XML-file with itself - a ready hierarchical database. It is necessary to set only restrictions and to write language of searches, as a basis for which will serve... All the same XML. For a role of such language of searches applies XML-QL, and version 0.9 is already accessible to users. The similar purpose put before itself and founders of languages XQL, YATL and XSQL.

And how Web?


So, the description of the data, language of searches. And how actually "ML"? In fact XML is eXtensible Markup Language, i.e. a markup language. How he looks as alternative HTML? And whether this alternative is necessary? On last question the majority of experts unanimously respond " Yes! ". Language HTML badly copes with a role of the basic means of the publication in Web. his  main lack will consist in full absence of toolkit for structurization of documents. Such quality as flexibility, too it is poorly inherent HTML. New opportunities at the best become accessible with an output{exit} of the next version, and until then - manage that, that you have.


The founder of the XML-document is not limited to the fixed complete set of descriptors. Moreover, their predetermined set simply does not exist - all descriptors necessary for the description of the document, the developer thinks out itself. For those who has got used to work with HTML, it seems improbable.


Full freedom in a choice of names of elements is compensated by rigid requirements to structure of the document. As against HTML, in XML to each opening descriptor corresponds{meets} closing, the pair descriptors forms element XML. to tell the truth, in the XML-document there can be and single descriptors, but it not an exception of a rule, and only the pair descriptors incorporated into one.


The severe hierarchy and the attitude{relation} parental - affiliated between elements XML open new, unprecedented before an opportunity at realization of search engines. Now, when contents Web basically will consist of HTML-documents, the user should be content with keyword search. If in the document there is no structure, the search engine cannot to define{determine}, for example, on keyword Pascal, there is a speech about the programming language or about the scientist in honour of whom this language has been named. If documents are structured, the question with a context is solved much easier: it is necessary, setting criteria of search to specify required section.


The hierarchical structure enables to resolve one more problem easily. For today if the user needs not the document, and only his  part, all the same it is necessary to copy the whole file on a network. Notwithstanding what HTML allows to note a marker a position inside the text, to define{determine}, where the section comes to an end, it is impossible. If thus the enclosure of elements is strictly observed, copying of one unit becomes quite real problem . For its{her} decision specification XML Pointer Language, or Xpointer, regulating the order of addressing of fragments of the XML-document is intended.


So, potential opportunities it is available. It are necessary to realize them only.


Structure on the screen


To write the simple XML-document absolutely simply, with it will consult even beginning{starting}. And for those who absolutely knows nothing about XML, in Internet the set of manuals is published, one of which promises to train in this language of all for 11 and a half of minutes. Approximately it is so much time also it is necessary for the newbie that on his  computer the file which contents look approximately as on sledujuhhme an example has appeared:



<? xml version = " 1.0"?>

  <OS>

   <UNIX>

     <BSD>

       <Name> FreeBSD </Name>

       <Platform> Platform: PC and oth. </Platform>

    </BSD>

  <SunOS>

      <Name> SunOS </Name>

      <Platform> Platform: Sun </Platform>

  </SunOS>

</UNIX>

<Win95>

     <Name> Windows 95 </Name>

     <Platform> Platform: PC </Platform>

</Win95>

</OS>


But, besides ability to describe the data, XML should "be able" to display them, otherwise about application in Web cannot be and speeches. At first sight completely not clear, in what kind the document will be displayed. Directly about it it is not spoken in one of managements{manuals}, and mimokhodom the thrown phrases often escape attention.


What to do{make} with the document? In fact in him there is no even a hint on formatting. Ridiculously to assume, that the browser can guess, in what kind the author would like to present the product on the screen, however it is difficult to be kept from temptation there and then to open it  in one of supporting XML browsers, the blessing, them becomes more and more. For the first experiment quite will approach Internet Explorer 5.0 or later version.


So, the document is open, and rather unexpected picture appears at eyes. It would be natural to expect the contemptious message on a mistake, but instead of it the structure of the document (fig. 1) is reproduced: the hierarchy of objects is observed; having clicked on a symbol "-", it is possible to curtail{turn} a part of the document, and on a sign "+" - to display her  again.



The result, certainly, impresses though to name his  high-grade Web-page it is possible hardly. The structure on the screen hardly will involve the visitor. Formatting nevertheless to not do without.


Tables of styles


To receive on the screen decent result, it is necessary to recollect cascade tables of styles (CSS) which often are used by developers of HTML-documents. For formatting the document it is enough to connect with it  a CSS-file, having defined{determined} style for each element (listing 2).



OS

{

  display: block;

  text-align: left;

  font-size: 16pt;

}

Name, Platform

{

  display: block;

}

Platform

{

  font-size: 12pt;

}


Now result achieve. On the screen the high-grade document, but created any more on HTML, and on XML (fig. 2) is displayed.



At first sight it seems, that XML does not allow to make anything such that could not be achieved with the help of means HTML and CSS. Moreover, if in HTML it is possible to leave a choice of performance of all elements at the discretion of a browser at construction of the XML-document it is necessary to think over a format of everyone independently. Certainly, it demands efforts and time, but then advantages XML become obvious.


In the XML-document the description of the data is completely separated from the description of a format. This property XML delivers set of troubles beginning{starting}. Taking into account, that the XML-document has strict treelike structure, it is possible to imagine, what rich opportunities are received by the Web-designer. We shall assume, that the developer has decided to allocate data on the liked system (certainly Unix) with red color. For this purpose it is necessary to add only one line in a CSS-file:


UNIX {color: red}


As you can see, a file with the description given to edit it is not necessary. In HTML for this purpose it would be required to analyse a code of the document, to find the necessary paragraphs (notice, that the sizes of a real file usually are not limited to ten lines) and to switch on in the initial text new descriptors. And if further the developer would decide to display headings any other color (for example, green), he almost for certain would get confused in a HTML-code. At job with XML required actions are still trivial.


It would seem, use CSS solves a problem with display of XML-documents, however at close examination it is necessary to recognize, that CSS does not allow to open potential opportunities XML completely.


Imagine, that, experimenting with visualization of the document, the developer has decided to reduce some the size of a font by which headings for BSD are displayed and SunOS (it is valid, in fact it is only various clones of one system), and to unit them in one subitem (for example, "UNIX"). But if to edit style of element Name, the heading for Win95 will decrease also, that contradicts the initial plan. That such transformation became possible{probable}, rules of formatting of the text should be context-dependent. It is necessary, that Name it was deduced{removed} differently proceeding from an accessory{a belonging} to a parental element.


Looking at a XML-file, which text it is resulted in the beginning of clause{article}, it is possible to notice, that in each of elements Platform word Platform: repeats. Would be reasonable at all to exclude this word from the initial text and to display it  during formatting.


After some reflections it is necessary to ascertain, that expressive means of cascade tables of styles do not allow to solve neither the first, nor the second a problem . And if at transition from CSS1 to CSS2 also there is an opportunity to distinguish a context for an insert of the text at a stage of formatting much more powerful means are required. Probably, to the same conclusion there came also developers XML as result of their activity became the specification of a modern language for formatting and transformations of XML-documents. This language has received name XSL (eXtensible Style Language).


Step for horizon: XSL


The life is full of unexpectedness. Having started to studying XML, the Web-master is compelled to recollect (or to study anew) CSS, then is found out, that to move further, it is necessary to understand opportunities XSL which leave far for frameworks of use XML in Web. Really, means XSL allow not only to format, but also to convert the XML-document, representing it  practically in any kind: from the formats used for the description of the text (PDF, PostScript, SGML, TeX), up to sound and graphic files.


But the one who will want to create the real XML-document and to place it  on the server (certainly, using XSL), the next problem traps. The matter is that many now in use browsers "are not unanimous" in interpretation XML, and the some people and at all do not support this language. The situation becomes complicated also that, that specification XSL still enough often is exposed to changes.


How to act{arrive}? Probably, it is necessary to recollect that XSL allows to transform formats almost without restrictions and to choose from them such what would in the best way be processed by browsers, that is... Old kind HTML. For this purpose we shall use the following XSL-description:



<? xml version = " 1.0"?>

<xsl:transform version = " 1.0" xmlns:xsl = " http: // www.w3.org/1999/XSL/Transform ">

  <xsl:template match = "OS">

    <html>

      <xsl:apply-templates/>

    </html>

    </xsl:template>

  <xsl:template match = "Name">

    <H2>

      <xsl:apply-templates/>

    </H2>

  </xsl:template>

  <xsl:template match = "Platform">

    <H4> <I>

     <xsl:apply-templates/>

    </I> </H4>

  </xsl:template>

</xsl:transform>


At such performance of styles it is possible to adjust selectively a kind of one or several elements. To change a level of headings BSD and SunOS and to unit them in one section, there is enough the lines submitted on listing 4.


And to exclude word Platform: from the initial text, it is enough to change a corresponding element of the XSL-description.



<xsl:template match = "Platform">

  <H4> <I> Platform:

  <xsl:apply-templates/>

  </I> </H4>

</xsl:template>


Really, now means of the publication of the document have got new property which so lacked them earlier, - flexibility. Nevertheless to us is about what to reflect. Pay attention, that, trying to leave from restrictions, nakladyvaemykh HTML, it was necessary to study XML, to solve set of problems and... Again to return to HTML. A vicious circle? No, just it seems. In fact the initial text of the document is still submitted in language XML, his  style description is stored{kept} in a XSL-file, and HTML - only a target format which at any moment can be changed. If necessary to modify the document the structured XML-file, preobrazuemyj in HTML by means of formal procedure is edited only.


On an occasion at a whimsical browser


So, the XML-document and his  style description in a XSL-file are ready. It are necessary to present his  reader. But how it to make? The most simple decision - to pass XML-and XSL-given to a browser, having given to him to carry out transformation independently. But, as it was already spoken, the majority of browsers simply will not cope with processing of such document.


Apparently, a unique output{exit} comprehensible on today - to convert a XML-file on the server. It can be made dynamically at the reference{manipulation} of the client, and it is possible to perform transformation right after the terminations{endings} of job above the document and to represent on the server his  HTML-version. The manager of the Web-site should solve, that to him it is easier: to realize the ISAPI-filter recognizing the reference{manipulation} to XML-files, or to convert them after each editing.


By the way, developers have already taken care of necessary tools. One of the most popular converters under name XT, created by James Clark (James Clark), can work on various platforms. And to convert the document dynamically at the reference{manipulation} of the client to the server allows XML Enabler, realized as servleta.


Wind of changes in Web


What destiny is prepared habitual to all of us to language HTML? Whether he will concede a position to the competitor in person XML or will still be overcome for a place under the sun? It is obvious, that in near future HTML threatens nothing. The majority of developers of Web-documents will use still it . However lacks HTML are obvious, and XML possesses potential opportunities for their liquidation though it and will need persistent job of many experts. On a measure of expansion of support of a modern language XML-documents begin to supersede really HTML-pages from Web. However, it is possible, that in one perfect day the modern language, simple and at the same time floppy which resolute gesture will force to move both HTML, and XML will be developed. Similar examples in a history of information technologies already was much.



<xsl:template match = "UNIX">

  <H2> UNIX </H2>

  <xsl:apply-templates/>

</xsl:template>

<xsl:template match = " BSD/child:: Name ">

  <H3>

  <xsl:apply-templates/>

  </H3>

</xsl:template>

<xsl:template match = " SunOS/child:: Name ">

  <H3>

  <xsl:apply-templates/>

  </H3>

</xsl:template>