{"id":52640,"date":"2019-11-13T00:00:00","date_gmt":"2019-11-12T21:00:00","guid":{"rendered":"https:\/\/prohoster.info\/blog\/blog_prohoster\/xml-prakticheski-vsegda-primenyaetsya-ne-po-naznacheniyu"},"modified":"2020-02-18T14:00:25","modified_gmt":"2020-02-18T11:00:25","slug":"xml-prakticheski-vsegda-primenyaetsya-ne-po-naznacheniyu","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/xml-prakticheski-vsegda-primenyaetsya-ne-po-naznacheniyu","title":{"rendered":"XML is almost always used for purposes it was not intended for","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"XML is almost always used for purposes it was not intended for\" src=\"\/wp-content\/uploads\/2019\/11\/8152077415a94ef74806af230ef44bd7.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nThe XML language was invented in 1996. Barely had it emerged when its potential applications were already being misunderstood, making it a poor choice for the purposes it was being adapted for.<\/p>\n<p>It would not be an exaggeration to say that the overwhelming majority of XML schemas I have encountered were an impractical or incorrect use of XML. Moreover, such applications of XML reflect a fundamental misunderstanding of what XML primarily is.<\/p>\n<p>XML is a markup language. <b>It is not a data format<\/b>. In most XML schemas, this distinction was clearly overlooked, confusing XML with a data format, which ultimately meant that XML was an incorrect choice, as what was actually needed was a data format.<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nIf we do not delve into details, XML is best suited for annotating blocks of text with structure and metadata. If your main task is not working with a block of text, choosing XML is unlikely to be justified.<\/p>\n<p>From this perspective, there is a simple way to check how well an XML schema is constructed. Take, for example, a document in the assumed schema and remove all tags and attributes. If there is no meaning in what remains (or if an empty string is left), then either your schema is poorly constructed, or you simply should not have used XML.<\/p>\n<p>Next, I will provide several of the most common examples of poorly constructed schemas.<\/p>\n<pre><code class=\"xml\"><\/code><\/pre>\n<p>\nHere we see an unreasonable and strange (albeit quite common) attempt to express a simple \"key-value\" dictionary in XML language. If all the tags and attributes are removed, an empty string remains. Essentially, this document represents, however absurd it may sound, a semantic annotation of an empty string.<\/p>\n<pre><code class=\"xml\">&lt;root name=\"John\" city=\"London\" \/&gt;<\/code><\/pre>\n<p>\nWhat's worse, we don't just have a semantic annotation of an empty string here as an extravagant way to express a dictionary \u2014 this time, the 'dictionary' is directly encoded in the root element's attributes. As a result, the specified set of attribute names on the element becomes indeterminate and dynamic. Furthermore, it is clear that all the author actually wanted to express was a simple 'key-value' syntax, but instead, they made the bizarre choice to use XML, forcing the use of a single empty element simply as a prefix for the attributes syntax. I come across such schemes very often.<\/p>\n<pre><code class=\"xml\">John\n  London<\/code><\/pre>\n<p>\nThis is already an improvement, but now the keys are somehow treated as metadata while the values are not. Quite a strange perspective on dictionaries. If you remove all tags and attributes, half the information will be lost.<\/p>\n<p>A proper representation of a dictionary in XML would look something like this:<\/p>\n<pre><code class=\"xml\">Name\n    John\n  \n  \n    City\n    London<\/code><\/pre>\n<p>\nBut if people have made the strange decision to use XML as a data format and then organize a dictionary with it, they must understand that what they are doing is inappropriate and inconvenient. Often, designers mistakenly choose XML for building their applications. But even more frequently, they exacerbate the situation with the senseless use of XML in one of the aforementioned forms, ignoring the fact that XML is simply not suitable for this.<\/p>\n<p><b>What's the worst XML scheme?<\/b> By the way, the prize for <i>the worst XML scheme I've ever seen<\/i> goes to the configuration file format for automatic resource provisioning for Polycom VoIP phones. Such files require loading XML request files via TFTP, which... In short, here's an excerpt from one such file:<\/p>\n<pre><code class=\"xml\">&lt;softkey\n        softkey.feature.directories=\"0\"\n        softkey.feature.buddies=\"0\"\n        softkey.feature.forward=\"0\"\n        softkey.feature.meetnow=\"0\"\n        softkey.feature.redial=\"1\"\n        softkey.feature.search=\"1\"\n\n        softkey.1.enable=\"1\"\n        softkey.1.use.idle=\"1\"\n        softkey.1.label=\"Foo\"\n        softkey.1.insert=\"1\"\n        softkey.1.action=\"...\"\n\n        softkey.2.enable=\"1\"\n        softkey.2.use.idle=\"1\"\n        softkey.2.label=\"Bar\"\n        softkey.2.insert=\"2\"\n        softkey.2.action=\"...\" \/&gt;<\/code><\/pre>\n<p>\nThis is not someone's failed joke. And this is not my invention:<\/p>\n<ul>\n<li>Elements are simply used as prefixes for attaching attributes that themselves have hierarchical names.\n<\/li>\n<li>If you need to associate values with multiple instances of a specific type of record, you must use attribute names, <i>which include indexes.<\/i>.\n<\/li>\n<li>In addition, attributes starting with <code>softkey.<\/code>, need to be placed on elements <code>&lt;softkey\/&gt;<\/code>, attributes starting with <code>feature.<\/code>, need to be placed on elements <code>&lt;feature\/&gt;<\/code> and so on, even though this may seem completely redundant and meaningless at first glance.\n<\/li>\n<li>And finally, if you hoped that the first component of the attribute name would always match the element name \u2014 that's not the case! For example, attributes <code>up.<\/code> must be attached to <code>&lt;userpreferences\/&gt;<\/code>. The order of attaching attribute names to elements is arbitrary and practically completely so.\n<\/li>\n<\/ul>\n<p>\n<b>Documents or data.<\/b>From time to time, someone does absolutely strange things, trying to compare XML and JSON, thus showing that they understand neither. XML is a markup language for documents. JSON, on the other hand, is a format for structured data, so comparing them to each other is like trying to compare warmth to softness.<\/p>\n<p>Understanding this will help clarify the difference between <i>documents and data.<\/i>As an analogy, XML can conditionally be considered a machine-readable document. Although it is intended for machine reading, metaphorically, it relates to documents and, from this perspective, is actually comparable to PDF documents, which are often not machine-readable. <\/p>\n<p>For example, in XML, the order of elements matters. In JSON, however, the order of the \"key-value\" pairs within objects is meaningless and not defined. If you want to get an unordered dictionary of \"key-value\" pairs, the actual order in which the elements appear in this file does not matter. But you can create many different <i>documents<\/i>, since there is a specific order in the document. Metaphorically, this is akin to a paper document, even though it does not have physical dimensions unlike a printout or a PDF file.<\/p>\n<p>In my example of the correct representation of a dictionary in XML, the order of elements in the dictionary is shown, unlike in the JSON representation. I cannot ignore this order: such linearity is inherently characteristic of document models and the XML format. Someone interpreting this XML document might choose to disregard the order, but arguing about it is pointless since this issue goes beyond the discussion of the format itself. Moreover, if the document is made viewable in a browser by attaching a cascading style sheet, it will be seen that the dictionary elements follow a specific order, and no other.<\/p>\n<p>In other words, a dictionary (a fragment of structured data) can be transformed into <i>n<\/i> various possible documents (in XML, PDF, on paper, etc.), where <i>n<\/i> \u2014 the number of possible combinations of elements in the dictionary, and we have not yet considered other possible variables.<\/p>\n<p>At the same time, this also suggests that if you want to convey just the data, using a machine-readable document will be inefficient. It uses a model that is unnecessary in this case; it will only hinder. Moreover, to extract the original data, a program will need to be written. It is hardly meaningful to use XML for something that, at a certain stage, will not be formatted as a document (say, using CSS or XSLT, or both), since this is the main (if not the only) reason to adhere to the document model.<\/p>\n<p>Furthermore, since there is no concept of numbers (or boolean expressions, or other data types) in XML, all numbers presented in this format are considered merely additional text. To extract data, the schema and its connection to the corresponding expressed data must be known. It is also necessary to know when, based on context, a particular text element represents a number and should be converted to a number, etc.<\/p>\n<p>Thus, the process of extracting data from XML documents is not significantly different from the procedure of recognizing scanned documents that contain, for example, tables forming multiple pages of numerical data. Yes, this is generally possible, but it is not the most optimal approach, unless in extreme cases when there are no other options available. A reasonable solution would simply be to find a digital copy of the original data that is not embedded in the document model where the data is intertwined with its specific textual representation.<\/p>\n<p>It doesn't surprise me at all that XML is popular in business. The reason for this is precisely that the document format (on paper) is clear and familiar to businesses, and they want to continue using a model that is both known and understandable. For the same reason, PDF documents are often used in business instead of more machine-readable formats \u2014 because they are still tied to the concept of a printed page with a certain physical size. This applies even to documents that are unlikely to ever be printed (for example, an 8000-page PDF file of registry documentation). From this perspective, the use of XML in business is essentially an expression of skeuomorphism. People understand the metaphorical idea of a physical page of limited size, and they know how to create business processes based on printed documents. If that is your guideline, documents without a restricted physical size, which are machine-readable \u2014 XML documents \u2014 represent an innovation while still being a familiar and comfortable analogue of a document. That doesn't prevent them from remaining an inaccurate and overly skeuomorphic way of representing data.<\/p>\n<p>To date, the only XML schemas that I can genuinely call a proper application of this format are XHTML and DocBook.<br \/>\n<br \/>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/475474\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u042f\u0437\u044b\u043a XML \u0431\u044b\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d \u0432 1996 \u0433\u043e\u0434\u0443. \u0415\u0434\u0432\u0430 \u043e\u043d \u0443\u0441\u043f\u0435\u043b \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0438 \u0434\u043b\u044f \u0442\u0435\u0445 \u0446\u0435\u043b\u0435\u0439, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0435\u0433\u043e \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043e\u043d \u0431\u044b\u043b \u043d\u0435 \u043b\u0443\u0447\u0448\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u043c. \u041d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0445\u0435\u043c XML, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0434\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0432\u0438\u0434\u0435\u0442\u044c, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e\u0435 \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 XML. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":52641,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-52640","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u042f\u0437\u044b\u043a XML \u0431\u044b\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d \u0432 1996 \u0433\u043e\u0434\u0443.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/xml-prakticheski-vsegda-primenyaetsya-ne-po-naznacheniyu\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47XML \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u043f\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u042f\u0437\u044b\u043a XML \u0431\u044b\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d \u0432 1996 \u0433\u043e\u0434\u0443.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/xml-prakticheski-vsegda-primenyaetsya-ne-po-naznacheniyu\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-11-12T21:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-02-18T11:00:25+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47XML is almost always misapplied | ProHoster","description":"The XML language was invented in 1996.","canonical_url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/xml-prakticheski-vsegda-primenyaetsya-ne-po-naznacheniyu","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47XML \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u043f\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e | ProHoster","og:description":"\u042f\u0437\u044b\u043a XML \u0431\u044b\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d \u0432 1996 \u0433\u043e\u0434\u0443.","og:url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/xml-prakticheski-vsegda-primenyaetsya-ne-po-naznacheniyu","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-11-12T21:00:00+00:00","article:modified_time":"2020-02-18T11:00:25+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"52640","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-24 04:19:19","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 11:11:32","updated":"2026-01-24 04:19:19","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/52640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=52640"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/52640\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media\/52641"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=52640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=52640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=52640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}