Home
Home Page
And again about functional programming on Python
Where the Python has come crawling?
Practical application OOP in PHP5
Functional programming in language Python
Approaches of language Python - an amusing example of optimization
Use ext/mysqli: Part I - the Review and the prepared expressions
How to receive the maximal result from registration in catalogues
XML-RPC In language Python
The API-specification of databases of language Python, version 2.0
Programming of the Web-client in language Python
Useful advice for job with XML
Future Web - behind semantics
Whether it is necessary to cancel spaces of names XML?
Use AJAX in ASP.NET
ASP .NET 2.0: Reference pages
Patterns of registration
What is ASP.NET. Installation and the test project.
Anatomy ASP.NET. ASP.NET in operation.
Server elements of management Continuation.
Links
 
topic



Whether it is necessary to cancel spaces of names XML?

As shows experience, spaces of names XML often become the reason of confusion, and also one of the major factors complicating development XML. In offered{suggested} clause{article} the author declares, that spaces of names XML cannot offer the good decision of those problems for which they were initially created; they also are not a necessary element in most cases practical use XML. He recommends to exclude spaces of names from the use or it is essential to reduce their use. When they are necessary, developers should choose the most optimum variants, and also the standard agreements to limit the syntactic variability offered{suggested} in specifications. It will allow to order spaces of names that will facilitate their understanding.

Problem


According to the author, very much often the developers using XML, not absolutely understand, that such spaces of names and if understand experience difficulties with practical job and at correction of the mistakes connected to them. Modern spaces of names XML demand more than two weeks for development of all nuances. The example of the problems connected to spaces of names, can be the asked question following often (see undressed Resources):


* Whether the recommendation of spaces of names XML defines{determines} something, except for system of names in which the names two-piece are used, for attributes and types of elements? - No.


The author of clause{article} declares, that, by his{its} experience, very much few developers using XML, really understand spaces of names. They are a subject of often and sharp discussions in various forums of developers. Fair will note, that the specification of spaces of names XML is one of the most disputable among basic specifications XML.

What advantages of space of names XML?


So, use of spaces of names XML is connected to a number{line} of real or imaginary difficulties. But spaces of names should give and the certain advantages. That about it it is possible to find in introduction in the corresponding specification:


" In applications of language XML separate document XML can include elements and attributes (further they are called " the dictionary of a marking ") which are defined{determined} for compound program modules where they are used. One of the reasons of such use is modul`nost`: if there is a dictionary of a marking which is well understood and for which there is a suitable software it is easier to use it{him}, than each time to invent something new.


Such documents containing compound dictionaries of a marking, represent a problem for recognition, and also create danger of conflicts among themselves. Program modules should be capable to distinguish tags and attributes for which processing they are developed, even at danger of occurrence of "conflict" in that case when the marking intended for other software package, uses the same types of elements or names of attributes ".


Thus, problems which should be solved, lay in the field of recognition and conflicts in that case when compound documents are simultaneously used some.


Further the author addresses to one more widespread question on spaces of names XML:

What purpose of creation of spaces of names XML?


Spaces of names XML are created to appropriate{give} to each element and attribute a unique name. It allows to carry out a lot of actions, such as:


* To unite fragments of various documents without occurrence of conflicts of names (see the example is lower);

* To write modules of codes which can repeatedly be used and caused for the certain elements and attributes. Unique names guarantee, that such modules will be caused only for necessary elements and attributes;

* To define{determine} elements and attributes which can be used in other circuits or real documents without danger to call the conflict of names. For example, elements XHTML can be used in the catalogue of spare parts for their description, and the zero attributes determined in circuits XML, - for a designation of the missed values.


The author advises to pay attention to the following example. The submitted problem will be, that element Address appears in two separate documents in two various contexts and thus has various values.


In that case there is a following question:


It is not a problem while the given types of elements exist only in separate documents. But what will take place, if they will be incorporated within the framework of one document, for example, the list of departments with addresses and web-servers?


It - production of a problem, and the example of the sanction of ambiguity of the general{common} element is below resulted at association of two documents.


The incorporated document looks as follows.


Listing 1. The incorporated document with spaces of names

<Department>

<Name> DVS1 </Name>

<addr:Address xmlns:addr = " http: // www.tu-darmstadt.de/ito/addresses ">

<addr:Street> Wilhelminenstr. 7 </addr:Street>

<addr:City> Darmstadt </addr:City>

<addr:State> Hessen </addr:State>

<addr:Country> Germany </addr:Country>

<addr:PostalCode> D-64285 </addr:PostalCode>

</addr:Address>

<serv:Server xmlns:serv = " http: // www.tu-darmstadt.de/ito/servers ">

<serv:Name> OurWebServer </serv:Name>

<serv:Address> 123.45.67.8 </serv:Address>

</serv:Server>

</Department>


And the same document without spaces of names. In him the problems connected to recognition and the conflict of names are distinctly visible.


Listing 2. The incorporated document without spaces of names



<Department>

<Name> DVS1 </Name>

<Address>

<Street> Wilhelminenstr. 7 </Street>

<City> Darmstadt </City>

<State> Hessen </State>

<Country> Germany </Country>

<PostalCode> D-64285 </PostalCode>

</Address>

<Server>

<Name> OurWebServer </Name>

<Address> 123.45.67.8 </Address>

</Server>

</Department>


For the sake of justice it is necessary to emphasize, that the second document looks less ambiguous, and various uses of element Address are hardly capable to bring in mess to the software.

Elements in a context


Unfortunately, the specification of space of names XML ignores one of main principles XML: documents XML are hierarchical; any tag is not isolated.


At a choice of this or that element Address the user can specify particularly, which element is necessary for him: the address of the server which is inside tags Server, or the address of a department designated by tags Department. In format XML it will look as follows:/Department/Server/Address or/Department/Address, accordingly. Such format does not bear{carry} any ambiguity; abundantly clearly, what element means in this or that case. It occurs because tag XML is defined{determined} by a context, and not just a name.


The ambiguity appears only at ignoring a context.


To ignore structure and hierarchy at job with XML is a fundamental mistake.


If the decision of a problem of ambiguity of tags at association of documents important for job of the application use of an existing context of document XML is much more simple way, than application of the complex{difficult} new model based on unique names. The decision of a problem of the conflict and recognition with the help of spaces of names XML is reduced to creation of unique names for each individual tag in all documents.


It is necessary to mean, that a way resulted in the above-named example, artificial enough. In a reality for reception of a similar situation there is no necessity to unite documents. Such incorporated document can appear a starting point. Even in one document there can be some elements with identical names, but various values. Under the certificate of the author, in practice such cases meet much more often, than the incorporated documents. If in any of these cases the user will appropriate{give} to each element a unique name he can simply use very long and unequivocal names. Thus, there is no necessity for spaces of names.


Actually the decision of a problem is consideration of elements in their hierarchical context. Standard language XML provides it, and any necessity for spaces of names does not arise.

More interesting examples


Standard situations of use XML and, in particular, case, illjustriruemyj an above mentioned example, do not demand spaces of names XML. But there are moments in which spaces of names or something similar can have value. Some such cases below are considered{examined}.


The first variant - use of spaces of names as method of identification of types of documents or management of their versions. The following designs are widespread{distributed} enough:



<env:Envelope xmlns:env = " http: // www.w3.org/2003/05/soap-envelope ">


It is an example of the uppermost tag of message SOAP 1.2. Here the space of names carries out the important problem{task}. It informs the consumer, that given element XML is envelope SOAP, is connected to international consortium W3C (World Wide Web Consortium) and corresponds{meets} to the version of the specification accepted in May, 2003. It, is unconditional, more informatively, than an alternative tag without space of a name: <Envelope>.


So, the given example looks as one of cases of justified use of spaces of names. Whether but so it? Identification, certainly, is necessary, but she{it} can be carried out and without spaces of names. Everything, that for this purpose is required, - attribute and the agreement similar to the following: to identify documents with the help of attribute documentIdentifier in the uppermost tag:



<Envelope documentIdentifier = " http: // www.w3.org/2003/05/soap-envelope ">


It is possible to consider other example. Spaces of names are widely used for maintenance of unique identifiers of types. Quite often there are fragments XML similar to the following:



<element name = "cost" type = "xsd:float"/>


Or



<element name = "greeting" type = "SOAP-ENC:string"/>


Here xsd and SOAP-ENC - identifiers of space of names which concern to types of circuit XML (XSD) and codings SOAP, accordingly. Thus, cost is an element such as float, determined according to XSD, and greeting - an element such as string, determined according to the specification of coding SOAP. still a similar example:



<cost xsi:type = "xsd:float"> 29.95 </cost>


This recording designates, that the element cost has the certain type determined XSI, and also that float is the type determined XSD. The key moment is that to each type the exclusive identifiers which have been not adhered to a context really are required. Here there is no association of one document to another, having coding XSD or SOAP. simply certain elements in each of the specifications used in the document, have own designations. The specification should be even not necessarily written on XML as the question is flat structure, simply the list of types. If the structure of type is hierarchical then it is necessary to specify completely a way to it{him}:



<cost xsi:type = "xsd:/types/simple/float"> 29.95 </cost>


In this example use of spaces of names XML is quite allowable. But if to see at him{it} is closer{more attentive}, it becomes obvious, that given element XML passes the information on type together with a tag. It is unusual enough, as, as a rule, the information on type is defined{determined} with help DTD or circuits XML in a separate file that relieves of necessity to repeat this information for each tag when it is required.


Probably, and this example is not proved enough case for use of spaces of names XML, but all the same their some advantage{benefit} is obvious. It can be generalized as follows: the method for an establishment of communication{connection} between attributes of elements and external reference points is represented useful. The element does not require space of names, but for his{its} attributes it can be necessary.


The author considers, what is it special enough case and that use of spaces of names XML should be limited to such cases, when there is no other reasonable ways.


"Condemnation" of spaces of names XML


The author considers, that the arguments resulted by him{it} convincingly enough testify to problems with spaces of names XML and about their limited applicability.


The author supports active objection against spaces of names XML and their exception of wide use. He does not consider, that in spaces of names there is in general no necessity, but asserts{approves}, that the need{requirement} for them arises very seldom and that the modern specification of spaces of names XML creates many problems. Use of spaces of names in general{common} documents XML at all is not the most successful practice; more likely, it very much zatratnyj a way.


In any case, spaces of names XML hardly will disappear absolutely, taking into account they have received what wide circulation. Also it is not clear, whether the new specification can improve essentially a situation as the previous specification too was made by experts in this area.


But is reasonable and proved to change developed practice of use of spaces of names XML in all new specifications XML and web-services and to proceed{pass} to their limited application only when it is absolutely necessary, and also to exclude them from standard specifications.


At last, it is very important to develop agreements and the most effective methods for use of spaces of names XML that they were easier for understanding. The syntactic freedom provided with the specification, allows to place spaces of names practically in any place of the document, and also to express the same concept in the most various ways. The documents containing spaces of names, it will be much easier to understand, if the community of developers can develop uniform syntax for each concept. It will be perfect, if one sight at document XML abounding with spaces of names, appears enough to understand it{him}.