View, creation and structure of the XML file

XML is the Extensible Markup Language file extension used to create common information formats and share both the format and data on the World Wide Web, intranets, and elsewhere using standard ASCII text. It is a universal data and structured document format with XML extension. Like HTML, it uses word tags separated by ">" and "<" characters to structure the data in the document. But what is included in the structure of the XML file?

A brief introduction to the language

A brief introduction to the XML language




The language being studied (EXtensible Markup Language) began to develop in September 1996, with the support of the W3C, with the goal of creating an optimized tool for the Internet. The structure of the XML file combines the simplicity of HTML with the expressive capabilities of its predecessor, SGML. Such companies as Microsoft, IBM, Sun Microsystems, Novell and Hewlett-Packard took part in its development. Version 1.0 was ratified by the W3C at the SGML / XML conference held in Washington in December 1997. A few years later, XML became the language that had the greatest impact on developing applications for publishing content on the Internet.

The main characteristics of the language




The editors of the documents pursue the following goals:





  1. Distinguish the contents and structure of the XML file from the presentation on paper or on the screen.
  2. To clarify the device and informative content.
  3. Create documents that can be exchanged and easily processed in heterogeneous computer systems.
  4. Creating formats in which labels are set in the text of documents to distinguish between its parts or elements of the structure of the XML file.

The main characteristics of the language are:

  1. Possibility of descriptive marking, with an open set of labels. In HTML and XML, labels are interleaved in documents. The main difference between the two lies in the function of these brands.
  2. The function of differentiating the informative content of documents compared to use in HTML, where labels are used to indicate how the content should be viewed.
  3. On the other hand, while HTML reports which labels can be used to create the document, the language being studied does not define a valid set of labels. But he offers rules for creating an XML file that allow you to install new dictionaries and tag sets for various types.
  4. It makes a clear difference between the structure of the document and its presentation. Labels in an XML document do not indicate how it should be presented. To present it on the screen or on paper, you will need to create a separate style sheet and link it later with the document.
A brief introduction to the XML language




When the client computer connects to the database, SQL is sent to the federated database and uses the XML wrapper to access them from the file. They are returned to the client computer in the form of structured data contained in a relational result table.





Using the XML wrapper, you can map data from an external source into a relational schema consisting of a set of aliases. The structure of the document is logically equivalent to the relational scheme, where repeating and nested elements are modeled as separate tables with foreign keys.

The continuous evolution of language

The continuous evolution of language




Since its initial launch on the Internet, the XML language has generated a large number of initiatives related to the exchange and encoding of content and metadata. XML has unanimously become the primary option for managing and restoring data. The list of initiatives is wide, and although not all of them have reached the same level of adoption, there are numerous examples of the successful use of the language in the academic, business and institutional fields.

During 2004, publications of new proposals and initiatives related to the use of the language appeared. Examples include the constant publication of new versions of computer applications designed to work with XML, the development of new dictionaries, or the adoption of a language in various fields of work.

Extensible Markup Language has great support from international standardization bodies, which allowed to ensure a high level of standardization of electronic commerce between companies. Proof of this is the publication of language specifications as the ISO standard and the recent update to the UDDI standard (universal description of XML file structure and discovery). These two standards have sparked interest in new investments in information technology, which has slowed in previous years due to a lack of confidence in Internet markets.

Extensible Markup Language

XML is like HTML. They contain markup characters to describe pages or a file. HTML, however, describes the content of a web page primarily in the form of text and graphic images, only in terms of how they should be displayed and interact.

XML describes in terms the content of what data is described. For example, the word “phonenum” placed in the markup tags may indicate that the next data will be a phone number. An XML file can be processed by the program solely as data, stored with the same on another computer, or displayed as an HTML file. For example, depending on how the application on the receiving computer processes the phone number, it may be saved, displayed, or dialed.

XML is considered extensible because, unlike HTML, markup characters are unlimited and self-defining. XML is a simpler and easier to use subset of the Standard Generalized Markup Language (SGML) standard for creating document structure. HTML and XML are expected to be used together in many web applications. For example, XML markup may appear on an HTML page.

Match Aliases

Match Aliases




Aliases corresponding to an XML document are organized in a tree structure, where child aliases are mapped to elements corresponding to the parent. When they are repeated or have differentiated identifiers with complex structures, you can specify different aliases for each nested element.

The aliases parents and children are connected by primary and foreign keys generated by the shell. XPath expressions are used to correlate an XML document with a relational schema consisting of a set of aliases. XPath is an addressing mechanism for identifying parts of an XML file, such as groups of nodes and attributes in an XML document tree.

Its main syntax is similar to file system addressing. Each alias is defined by an XPath expression that identifies the elements representing individual tuples, and a set of expressions that specify how to retrieve the column values ​​of each element.

An XML document is associated with a set of aliases, and parent and child relationships are established using foreign and primary keys. XPath expressions are used to define individual tuples and columns in each element of a document, as well as how to execute a query in an XML document after it is registered with the federated system.

Tree structure of a sample document

Tree structure of a sample document




XML documents must have a root element - the parent for everyone else. They may contain nested elements, text, and attributes. The tree represented by such a document starts with the root element and branches to the lowest level of elements. Although there is no consensus on the terminology used in XML trees, the W3C has released at least two standard terminologies:

  1. The terminology used in the XPath data model.
  2. The terminology used in the XML infoset.

XPath defines a syntax with an expression name that identifies one or more internal components of the elements and attributes of an XML document. XPath is widely used to access XML-encoded data.

The XML infoset describes an abstract data model for documents in terms of information elements. It is often used in native language specifications for the convenience of describing the design constraints allowed by them.

Data exchange

The ability to separate data storage from viewing means that with XML you can store your data in one format and view it in various ways without changing the storage method. A language can describe what the data represents. This means that you can describe how to display them - color, font, and formatting, and that they represent, for example, the signal received from the oscilloscope, the value of the alarm indicator, and much more.

Together, these advantages allow you to store any information in a single storage format that can be defined for applications. You can also access them in any other application, just knowing that it is reading XML files. This is useful on a single computer for exchanging data between applications, but the real advantage of this functionality is a multi-computer environment.

You can use the following example as a model for how to create an XML file and display data from it. Suppose that a series of data points from a test platform has been completed and some basic analysis of this data has been carried out.

Next, you need to write all this raw data along with the analysis to a file. To output them to a file, you need to plan what the XML file you want to create should look like. Using this scheme, all data and analysis results are written to an XML file. The ability to customize fields in a file, such as "data", "average", "max" and "min", is part of the flexibility and power of XML.

Test application development

Test application development




When a user has an XML file that contains useful data, sooner or later, they will need to be applied. To do this, you can easily display them in any text editor or open them in a browser with XML support, for example, in Microsoft Internet Explorer. If you need to display them not just as text, you can use everything from database applications to web browsers.

These applications need a stylesheet to read the XML file. Using style sheets, you can view the same data in different ways. For example, one style sheet to display information for customers and another to present information to professionals who may need specific information to fix the problem. And you can also use the third style sheet to load all the data into the overall enterprise database system.

When performing this task, you will need to create three different data output methods in advance. Using XML and style sheets, you just need to create one data file that can be viewed in several formats that are specific to your tasks. Moreover, you no longer need to specify the type of application that will view the data, because the end user can create his own stylesheet to meet the needs of the application as soon as an XML file is provided.

XML will define corporate-wide data standards, so the developer will need to design only one schema file, which he can use, applying the appropriate parts of the schema in accordance with the needs of his application. Then it remains only to develop a style sheet for each data representation.

Using this system, test and measurement programs can easily exchange data with any application in the enterprise and each of them can create data and display it in another.

XDTO mechanism in 1C

XDTO mechanism in 1C




The creators of 1C, setting themselves the task of exchanging data using the language being studied, developed a mechanism - XDTO for objects that transfer the structure of the 1C XML file. What are the benefits? Program version 8.1 and higher allows the exchange of information with systems without delving into the topics of creating an XML file, solving most of the problems of 1C. And you can also send only the necessary information for the formation of the document. For this, the programmer will need to perform some procedures in advance.

To download an XML file using XDTO, you need to transfer the structure of the 1C file using a set of schemes created in a text editor or use special software. The result should be a file describing the unique type and structure used in XML. Before reading or writing the last file, the programmer loads the resulting configuration in the "XDTO Packages" area. To recreate, the user must have a main element and attachments with attributes. The resulting circuit is exported to an XSD file and sent together with the studied one, thus forming the XDTO package.

The biggest difference between using it to display data on the Internet and other technologies is that before you create an XML file, you must first use it to display data on a web page, which is similar to using a spreadsheet.

Common mistakes

XML is so simple that almost anyone can learn it. Wide access is a key advantage of the language. The disadvantage of XML is that the rules that exist in the language are absolute. XML parsers leave little room for errors. Regardless of whether the developer is a beginner or has worked in the language for many years, the same common errors appear again and again. Consider them in order to prevent.

So, common errors in the structure of an XML file:

  1. You must specify the language using the declaration operator so that the browser understands the code in which it is written.
  2. XML works in a hierarchical style. This means that all child elements must have parents, data lines must be between the element tags, comments must be inside the tags.
  3. XML requires that all tags be closed. In HTML, you can avoid accidentally opening a tag, and some browsers even close tags when displaying a page. An open tag XML document will always throw an error.
  4. Since the language being studied works in a tree structure, each page must have a root element on top of the tree. The element name does not matter, but it must be there before you get the structure of the XML file. Otherwise, subsequent tags will not be properly nested.
  5. XML interprets 50 spaces in the same way as one. The language collects several spaces, known as white space characters, and compacts them into one. This has nothing to do with visual display or design. The space used to align text does not mean anything in the XML code, so if a developer adds a lot of extra spaces to try to demonstrate some kind of visual layout or design, he simply loses time.

XML offers a good data exchange solution for a wide range of interested consumers in a convenient and easy to use format. Applications such as 1 C continue to integrate new technologies, such as XML, to provide the user with new data processing capabilities.




All Articles