1c how to upload data to xml. XML file generation

In an organization, accounting can be kept not only in solutions based on the 1C: Enterprise platform, but also in other software systems (Galaxy, Parus, SAP, etc.). In this case, the tasks of integrating two applications appear.

For example, in some application (let's call it "X") you want to read a list of configuration documents. We will not talk about the practical benefits of solving such a problem, I will only note that the most convenient and universal way in such a situation will be to unload a list of documents in XML format.

Exchange using this format is universal since most applications can work with it. Let's consider how it is possible to unload the list of configuration documents into an XML file from 1C: Enterprise.

Export to XML

And so, let's move on to the main thing. We need to traverse the list of document metadata and form the list in an XML file. The following screenshot shows the algorithm for generating an XML file:

NewXML () Export function // Get the name of the temporary file Path \u003d GetTemporaryFileName (); // Initialize the XMLWriter class Record \u003d New XML Record; // Open a temporary file for writing- 8 " ) ; // Write the XML file declaration Recording. WriteXMLDeclaration (); // Record. WriteItemStart (" DocumentsConfigurations" ) ; // First item // Attribute of the first element with the date of file formation Recording. WriteAttribute ("generated", Format (CurrentDate (), "DF \u003d yyyy- MM- ddThh: mm: ss; DLF \u003d DT" ) ) ; // Write an item for each configuration document. Place the name of the document in the text. For Each Dock From Metadata. Documents Cycle Recording. WriteElementStart ("Document"); Recording. WriteText (Doc. Name); Recording. WriteEndElement (); End of Cycle; // Finish writing the first item Recording. WriteEndElement (); Recording. Close (); // Close the file // Get the binary data of the file and put it in temporary storage BinaryData \u003d New BinaryData (Path); Address \u003d PutToTemporaryStorage (BinaryData, New UniqueIdentifier); Return Address; // Return the file address to the storage EndFunction

Each element created must be completed correctly. After executing "WriteElementBeginning ()", the "WriteElementEnd" method must be executed, otherwise the structure of the XML file will be incorrect.

The general pattern for creating XML files is the following sequence:

// 1. Initialize the class "XML Writer" Record \u003d New XML Record; // 2. Open a temporary file for recording Recording. OpenFile (Path, "UTF - 8 " ) ; // 3. We write the declaration of the XML file Recording. WriteXMLDeclaration (); // // 4. ++ Writing the content of the XML file Recording. WriteElementStart ("XML Element"); Recording. WriteEndElement (); // - Write the contents of the XML file // 5. Close the file Recording. Close ();

Almost any XML file is created with these five steps.

In our example, the generated file is converted to binary data and returned to the place where the CreateXML function was called. This file can then be written to the file system.

You could see an example of an uploaded file in the screenshot above.

Third party application

For the example, I created a .NET Framework application to demonstrate how to read an XML file in a third-party application.

The program reads the created file and displays the documents as a list:

You can try it yourself, the application is available for download at the link at the end of the article.

Versatility

The XML format is used in most configurations for data exchange between application solutions on the 1C: Enterprise platform. Another commonly used exchange method is a COM connection. XML allows you to exchange with almost any application, which is why it deserves to be called universal.

Files to download:

XML file reader application.

XML file generation processing.

2018-11-15T19: 32: 35 + 00: 00

Universal processing "Upload and download of XML data" performs full or partial upload of infobase data into a file in XML format. Subsequently, this file can be loaded into the infobase using the same processing. The format of the upload file differs from the format of the file created when uploading according to the exchange plan by the header part.

Processing can be used only in cases where the infobase in which the data was downloaded and the one in which the data is loaded are homogeneous (the configurations are identical, the data may differ), or all unloaded objects are almost completely identical in composition and types of attributes and tabular sections, properties of the "lead" metadata object, and so on.

The use of this processing is possible, for example, to create a full or partial backup of data, to exchange data between infobases, and also as an auxiliary tool in restoring failed infobases.

Processing supports data uploading with the ability to specify a selection by period. Also, objects are checked for invalid characters when exchanged via XML.

Best regards, (teacher and developer).

When creating a website for a company in a social business network, the website gives you the opportunity, without much effort, to upload your goods and services from the 1C version 8.2 to your online store. To do this, you need to use the external unload XML data processing. This processing, if necessary, can be found on the ITS disk.

You can upload no more than 100 products from the 1C program to your website.

To use the processing, you need to open the 1C program, in the main menu click on the button "file", choose "open" and indicate the path to processing. Then in the window that opens, in the field "file name", specify the name and folder where the XML file will be uploaded. After that, on the left side of the screen, you must indicate what you need to unload. Finally, press the button "unload data"... To upload to the online store in your personal account, you must click the Upload XML button and specify the path to the file that was downloaded from 1C. The integration is based on Russian and international standards and protocols for electronic data exchange.

1 To use the processing, you need to open the 1C program, in the main menu, click "file", choose "open" and indicate the path to processing.

2. After that, in the window that opens, in the field "File name", specify the name and folder where the XML file will be uploaded.

3. Then, on the left side of the screen, you must indicate what you need to unload.

4 ... Finally, press the button "Upload data".

Today we will consider with you processing "Universal XML upload for 1s 7.7"... This processing is intended for unloading data according to exchange rules into an XML file. Data unloading rules are also an XML file, which contains a description of what data and in what structure should be unloaded into an XML file.

How to use the processing of universal unloading in XML for 1c 7.7?

Below in the screenshot you can see the main processing form universal export to XML for 1s 7.7, let's take a look at the basic parameters that are necessary for its correct operation. Where the number 1 is, there we indicate the file with the rules for uploading data, for which these rules are needed, we already spoke in the first paragraph of the article. For number 2, select the file where the data will be uploaded. In paragraph 3, you must specify the start date and end date, during this period the data will be uploaded to a file. After we have specified all these parameters, click "Load rules", after reading the rules in paragraph 5, a tree-like structure of the exchange rules file with the names of the rules will appear. Now all we have to do is click the button in our processing universal unloading XML 1s 7.7under the number 6 "Upload", after this action, all data will be uploaded in accordance with the current rules for uploading data, into the XML file that we specified in paragraph 2.

Data transfer is a very important process in any accounting system, 1C 8.3 and 8.2 platforms are no exception. Below we will look at the instructions on how to easily transfer data from one system to another with a similar configuration (for different configurations, you can use a tool for programmers - or).

Before any action is necessary, the changes are irrevocable!

The easiest and most convenient way to transfer data from 1C 8.3 to 1C 8.3 accounting 3.0 is to use the processing Upload and download data in XML format (download - for 8.2 or for 1C 8.3 or on ITS). The processing is versatile and suitable for any configuration.

We will not go into details, we will consider the step-by-step instructions for migrating data using this processing using the example of the simplest transfer of goods.

Exporting data to XML

First of all, let's open the processing in the source database (from where we will unload the goods) and look at the interface:

Get 267 1C video tutorials for free:

It is immediately necessary to fill in the "File name" field - a new data file will be created along this path, which we will load into the receiver database. Slightly below, in the tabular section "Data for upload", you must select the data that we want to upload from the database.

After selecting an object from the left tabular section, you can apply selection in the right tabular section:


In our example, I want to unload all the goods with the name "Rake".

After all the settings are filled in, the data can be downloaded. To do this, you must click on the "Upload data" button:


Loading data from xml into 1c 8.3

The data has been unloaded from the source base, now it needs to be transferred to the destination base.

To do this, you need to start processing already in the database into which you need to load the data, and go to the "Download" tab, select the downloaded file on disk and click on the "Load data" button:


This example is only suitable for transferring data between identical configurations on the 1C platform. To understand the exchange mechanism, for programmers, we wrote an article -.

The transfer of information between databases is one of the tasks of their support and administration. For its effective implementation, processing is created in automated 1C complexes. They greatly facilitate routine work, speed up the process of uploading and downloading information, and at the same time control its correctness. Unloading from 1c to xml allows you to create a file with the contents of any object of a configured configuration, and use it when you need to unload data into an identical configuration.

Tools for creating an upload

The xml format is mainly used to export information contained in databases. For 1C, a lot of processing has been developed (for example, UnloadingLoadingDataxml82 epf), with which it is possible to output to a file and load data. In this case, the user must receive a file of a certain structure, which allows loading the information stored in it into the native database or transferring it to another location. When creating an unload, observe the following rules:

  • Save the created files until the moment of complete recovery and the end of the procedures for checking the correctness of the transferred information;
  • In the case of using processing as a backup tool, create separate subfolders for copies of data and keep a log of their accounting for quick retrieval.

The universal processing "Upload and download XML data" supplied in the 1C user support program, which can be found on the ITS website or disks, is an excellent tool for exporting and importing information. A computer user can unload both the entire database and its individual objects, while in addition to the actual export, various information verification operations are performed to help get rid of critical errors in the data. Processing 1c unloading to xml works in two modes:

  • Unloading. Creates a file containing user-defined objects to upload;
  • Loading. Reads a previously exported file and writes the information contained in it to the infobase.

Processing allows you to control objects for invalid characters, and also includes the function of exporting information with restrictions.

Unloading can be used not only when exchanging information between 1C databases. With its help, it is possible to ensure the integration of various complexes, for example, 1C and the Parus system. The versatility of the XML format allows you to create programs for transferring information for almost any information bank. Processing, uploading and downloading of xml data is the most important information exchange tool.

The process of uploading data toxml

Let's consider how to unload from 1c to xml in normal mode. After uploading the UnloadingLoadingDataxml.epf processing and opening it, you must perform the following steps:

  • Select objects for export;
  • Set up the necessary filters, for example, by period;
  • Determine the location of the information file on the disk subsystem;
  • Start unloading objects.


It should be remembered that the header part of the upload file format differs from the file format used when uploading according to exchange plans.

xml

Loading xml in 1c is performed in the receiving base with the configuration identical to the source base. Before loading in 1c xml 1c, you need to open processing in the receiver base. Then you need to specify the path to the previously uploaded file and load the data by clicking on the "Load data" button.

If necessary, the checkboxes are activated for loading data in the exchange mode in a distributed infobase and ignoring errors that occur when loading objects.


After that, you need to check the databases and make sure that all the elements are loaded correctly so as not to get their loss, for example, if an error occurred in the event handler after loading the object.


This processing allows the exchange of data between the same (identical) configurations on the 1C 8.2 platform - Bukh, ZUP, UT, UPP and others, the main thing is that the configurations are the same!

Processing screenshots

(foto)

Operating modes

Processing implements 2 modes of operation: Unloading (creating an unloading file specified by the user) and Loading (reading the unloading file created by the mode of the same name and writing the data available in it). The mode is set by selecting in the Mode field.

Before starting this or that mode (pressing the Run button), you need to specify the name of the upload file either by entering it manually in the "File name" field, or by using the button for selecting this field and the standard file selection dialog.

In the download mode, it is possible to edit the use of totals when writing registers, which may affect the download speed.

The buttons "Disable totals" and "Include totals" are available when the checkbox "Enable the ability to edit the use of totals during data loading" is checked and are used to manually control the mode of using totals during data loading.

Conditions of applicability of processing

Processing can be used only in cases where the infobase in which the data was downloaded and the one in which the data is loaded are homogeneous (the configurations are identical, the data may differ), or all unloaded objects are almost completely identical in composition and types of attributes and tabular sections, properties of the "leading" metadata object, and so on. It should be noted that, due to the specified limitations, processing is mainly intended for exchange between homogeneous information security.

The format of the upload file differs from the format of the file created when uploading according to the exchange plan by the header part. To unload data (elements of directories, sets of register records, etc.), processing uses the same XML serialization mechanism as unloading according to exchange plans; in this part, the file formats are identical.

Determination of the composition of the unloading

Processing allows both full and partial uploading of infobase data to a file. The composition of the uploaded data is configured in the dialog by checking the boxes in the column of the tree displaying metadata objects, the data on which can be uploaded. An additional column of flags, "If necessary", sets the need to unload objects of this type "by reference". That is, if the checkbox is selected only in the "If necessary" column, then the data for such an object will not be completely unloaded, but only to the extent that is necessary to maintain referential integrity in the infobase that will load the unloading file.

When the form is opened, processing sets the sign of unloading by reference to all objects, which guarantees the referential integrity of the unloaded infobase fragment.

When you click on the "Define objects to be uploaded by link" button, the processing analyzes the links to which data can be contained in the objects that have the complete unloading flag set, and automatically fills in the column of flags indicating the need to upload by link. If the object already has the full upload check box selected, then the upload by link check box is not set.

Possible applications

The use of this processing is possible, for example, to create a full or partial backup of data, to exchange data between infobases, and also as an auxiliary tool in restoring problem infobases.

In an organization, accounting can be kept not only in solutions based on the 1C: Enterprise platform, but also in other software systems (Galaxy, Parus, SAP, etc.). In this case, the tasks of integrating two applications appear.

For example, in some application (let's call it "X") you want to read a list of configuration documents. We will not talk about the practical benefits of solving such a problem, I will only note that the most convenient and universal way in such a situation will be to unload a list of documents in XML format.

Exchange using this format is universal since most applications can work with it. Let's consider how it is possible to unload the list of configuration documents into an XML file from 1C: Enterprise.

Export to XML

And so, let's move on to the main thing. We need to traverse the list of document metadata and form the list in an XML file. The following screenshot shows the algorithm for generating an XML file:

NewXML () Export function // Get the name of the temporary file Path \u003d GetTemporaryFileName (); // Initialize the XMLWriter class Record \u003d New XML Record; // Open a temporary file for writing - 8 ") ; // Write the XML file declaration Recording. WriteXMLDeclaration (); // Record. WriteItemStart (" DocumentsConfigurations") ; // First item // Attribute of the first element with the date of file formation Recording. WriteAttribute ("generated", Format (CurrentDate (), "DF \u003d yyyy- MM- ddThh: mm: ss; DLF \u003d DT")) ; // Write an item for each configuration document. Place the name of the document in the text. For Each Dock From Metadata. Documents Cycle Recording. WriteElementStart ("Document"); Recording. WriteText (Doc. Name); Recording. WriteEndElement (); End of Cycle; // Finish writing the first item Recording. WriteEndElement (); Recording. Close (); // Close the file // Get the binary data of the file and put it in temporary storage BinaryData \u003d New BinaryData (Path); Address \u003d PutToTemporaryStorage (BinaryData, New UniqueIdentifier); Return Address; // Return the file address to the storage EndFunction

Each element created must be completed correctly. After executing "WriteElementBeginning ()", the "WriteElementEnd" method must be executed, otherwise the structure of the XML file will be incorrect.

The general pattern for creating XML files is the following sequence:

// 1. Initialize the class "XML Writer" Record \u003d New XML Record; // 2. Open a temporary file for recording Recording. OpenFile (Path, "UTF-8"); // 3. We write the declaration of the XML file Recording. WriteXMLDeclaration (); // // 4. ++ Writing the content of the XML file Recording. WriteElementStart ("XML Element"); Recording. WriteEndElement (); // - Write the contents of the XML file // 5. Close the file Recording. Close ();

Almost any XML file is created with these five steps.

In our example, the generated file is converted to binary data and returned to the place where the CreateXML function was called. This file can then be written to the file system.

You could see an example of an uploaded file in the screenshot above.

Third party application

For the example, I created a .NET Framework application to demonstrate how to read an XML file in a third-party application.

The program reads the created file and displays the documents as a list:

You can try it yourself, the application is available for download at the link at the end of the article.

Versatility

The XML format is used in most configurations for data exchange between application solutions on the 1C: Enterprise platform. Another commonly used exchange method is a COM connection. XML allows you to exchange with almost any application, which is why it deserves to be called universal.

Files to download:

XML file reader application.

XML file generation processing.

When an enterprise constantly uses some kind of software package in its work, then, naturally, the question of its constant support and administration always arises. There is no way to do with the tasks of data exchange, storage and recovery. Let's consider how to load or unload data from 1C in XML format, since this is an important procedure in this topic.

They are built so that when unloading, you can get an XML file, in which the data required by the client will be written. At the same time, simultaneously with the recording, the correctness of the transferred records is checked for critical errors.

Thus, unloading into an XML file (importing records) from one infobase and then loading from XML into another is an exchange of data in XML format between databases.

This procedure, especially with large amounts of information, saves a lot of manual work.

Import (resulting file) can also be used as an archive for recovery in unforeseen situations (in case of loss or damage).

A lot of such processing tools have been developed, and they are available on the Internet. Responsibility for their use falls on the shoulders (and head) of the client.

But for the official users of oneeski, the developers have created a universal "Upload / download XML data" handler.

IMPORTANT. Export to XML in 1C and further loading into XML from 1C is permissible for identical configurations - otherwise it will be damaged.

Generic handler

Highlights for using a generic developer:

  • Save the import of files until the end of the transfer of records and check their correctness;
  • When used as backups, keep track of them for sorting searches.

It has two modes of operation: creating a file when saving information and reading / writing it when importing.

In addition, the user can set additional restrictions both when exporting and loading data.

Retrieving records

Data can be unloaded both across the entire database and selectively - by object.

After downloading, installing and opening the handler, the following is done:

They are selected in the dialog box that opens after launch. To do this, check the boxes in the list that displays the metadata objects for extraction;

  1. The necessary filters are configured (for example, by date);
  2. A place on the disk space is selected;
  3. The operation itself starts.

Fill records into the receiver

The first step for receiving data into the receiving database is to open a handler program in it.

After the path to the source file is indicated and the checkboxes of the procedure settings are activated (if necessary), you can start the process with the button “Load data”.


Now you know how to load or unload data from 1C in XML format to save data and exchange between databases.

Write in the comments about your experience in this matter.