The process of uploading data to xml. Generating an XML file. Easy upload for third party application. The process of uploading data to xml How to upload an xml file in 1c

When an enterprise constantly uses some kind of software package in its work, then, naturally, the question of its ongoing support and administration always arises. There is no way to avoid the tasks of exchanging, storing and restoring data. Let's look at how to load or unload data from 1C in XML format, since this is an important procedure for this topic.

They are built in such a way that when uploading, you can receive an XML file in which the data necessary for the client will be recorded. At the same time, simultaneously with the recording, the correctness of the transferred records is monitored for critical errors.

Thus, uploading to an XML file (importing records) from one information base and subsequent loading from XML to another represents an exchange of data in XML format between databases.

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

Import (the resulting file) can also be used as an archive for recovery in unexpected situations (if lost or damaged).

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 official users of Odeneski, the developers have created a universal processor “Upload/Load XML Data”.

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

Universal handler

Key points for using the universal developer:

  • Save importing files until the transfer of records is completed and their correctness is checked;
  • When used as backup copies, a record of them should be kept to sort the search.

Its operation has two modes: 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.

Extracting records

You can upload data both throughout the entire database and selectively - object by object.

After downloading, installing and opening the handler, the following occurs:


Their selection is made in the dialog box that opens after launch. To do this, check the boxes in the list that displays the metadata objects to be retrieved;

  1. The necessary filters are configured (for example, by date);
  2. Disk space is selected;
  3. The operation itself starts.

Uploading records to the receiver

The first step to accept data into the receiving database is to open the processor program in it.

After the path to the source file has been specified and the procedure settings flags have been activated (if necessary), you can start the process with the “Load data” button.

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

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

Before any action is necessary, the changes are irreversible!

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 load data in XML format (download - for 8.2 or for 1C 8.3 or on ITS). The treatment is universal and suitable for any configuration.

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

Uploading data to XML

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

Get 267 video lessons on 1C for free:

You must immediately fill in the “File name” field - a new data file will be created along this path, which we will upload to the receiver database. Just below, in the tabular section “Data for uploading”, you need to select the data that we want to upload from the database.

After selecting an object from the left table part, you can apply selection in the right table part:

In our example, I want to unload all products with the name “Rake”.

Once all the settings have been completed, the data can be uploaded. To do this, click on the “Upload data” button:

Loading data from xml into 1s 8.3

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

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 -.

Operating modes

Processing UploadLoadDataXML82 implements 2 operating modes: Upload (creating an upload file of user-specified data) and Load (reading an upload file created by the mode of the same name and writing the data contained in it). The mode is set by selecting it in the Mode field.

Before starting a particular mode (clicking the Run button), you need to specify the name of the upload file, either by entering it manually in the “File name” field, or using the button to select this field and the standard file selection dialog.

In download mode, it is possible to edit the use of totals when writing registers, which may affect the download speed. The “Disable totals” and “Enable totals” buttons are available when the “Enable the ability to edit the use of totals while loading data” flag is set and are used to manually control the mode of using totals when loading data. ** Conditions of applicability of processing**

Processing can only be used in cases where the information base in which the data was uploaded and the one in which the data was loaded are homogeneous (the configurations are identical, the data may differ), or all the uploaded objects are almost completely identical in composition and types of details and tabular parts, properties of the “leading” metadata object, etc. It should be noted that, due to these limitations, processing is mainly intended for exchange between homogeneous IS.

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

Determining the composition of the unloading

Processing allows for 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 that displays metadata objects for which data can be uploaded. An additional column of checkboxes, “If necessary,” sets the need to unload objects of this type “by reference.” That is, if the checkbox is checked only in the “If necessary” column, then the data for such an object will not be downloaded completely, but only to the extent that is necessary to maintain referential integrity in the infobase that will load the download file.

When opening a form, processing sets the sign of unloading by reference to all objects, which guarantees the referential integrity of the unloaded fragment of the information base.

When you click on the “Detect objects downloaded by link” button, processing analyzes which data links may be contained in objects that have the full download flag set, and automatically fills in the column of flags indicating the need to download by link. If the object already has the full unload flag set, then the unload by reference flag is not set.

Possible applications

The use of this processing is possible, for example, to create a full or partial backup copy of data, exchange data between information bases, and also as an auxiliary tool when restoring problematic information bases.

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

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

Processing can only be used in cases where the information base in which the data was uploaded and the one in which the data was loaded are homogeneous (the configurations are identical, the data may differ), or all the uploaded objects are almost completely identical in composition and types of details and table parts, properties of the “leading” metadata object, and so on.

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

Processing supports data uploading with the ability to specify selection by period. Also implemented is checking objects for the presence of invalid characters when exchanged via XML.

Sincerely, (teacher and developer).

- well-known web pages, which are also an analogue of XML with weak checks.

XML Reader/Writer Objects, FastInfoset, HTML extend text file reading capabilities with built-in processing of markup tags.

They are also used for DOMBuilder/DOMRecord objects (see below) as data sources.

XML 1C files contain text information, that is, they are text files. The 1C XML Reader and 1C Write XML objects are an “add-on” that makes it easier to work with XML tags in a 1C file.

The objects ReadingFastInfoset 1C and WritingFastInfoset 1C, ReadingHTML 1C and WritingHTML 1C are completely similar to ReadingXML 1C and WritingXML 1C and serve to work in the same way with other formats.

XML 1C file used in the examples

Directory>

Directory>

Text valueProps>
Directory>
Configuration>

Example 1. Reading a 1C XML file into a value tree using Reading XML 1C

//open the XML 1C file for reading using ReadingXML 1C
File = New ReadXML();
File.OpenFile("D:\ConfigurationStructure.xml");

//prepare the value tree
//each XML branch can have a name, attributes and value
dzXML = NewValueTree();
dzXML.Columns.Add("Name");
dzXML.Columns.Add("Value");
dzXML.Columns.Add("Attributes");

//since an XML string can have several attributes, we will write them in the values ​​table
//each attribute has a name and a value
tAttributes = New ValueTable();
tAttributes.Columns.Add("Name");
tAttributes.Columns.Add("Value");

//the nesting level will help us understand when we need to add a nested branch, and when we need to go back up a level
Nesting Level = 0;
//current line is a tree line, will change as nesting increases
CurrentRow = Undefined;
//reading the XML 1C file is not done line by line, but according to the structure; when the file ends, reading will return FALSE
While File.Read() Loop

//we are interested in three types of nodes - the beginning of the element, the text (the value of the element) and the end of the element (to return to the top level)
If File.NodeType = XMLNodeType.ElementStart Then

Nesting Level = Nesting Level + 1;

//if this is the first line, then add it to the very top of the tree and save only the name
If CurrentRow = Undefined Then
CurrentRow = dXML.Rows.Add();
CurrentLine.Name = File.Name;
Continue;
Otherwise
//nested lines
CurrentRow = CurrentRow.Rows.Add();
CurrentLine.Name = File.Name; //save the name

//does this XML element have attributes?
If File.NumberAttributes() > 0 Then
//if yes, copy the prepared empty table to save attributes
tAttributesNode = tAttributes.Copy();
//cycle through the number of attributes of this element
For Account = 0 by File.Number of Attributes()-1 Cycle
//for each attribute, remember the name and value
Row = tNodeAttributes.Add();
Line.Name = File.AttributeName(Sch);
Row.Value = File.AttributeValue(Ac);
EndCycle;
//save the element's attribute table to the current line
CurrentRow.Attributes = tNodeAttributes;
endIf;
endIf;

ElseIf File.NodeType = XMLNodeType.EndElement Then
//at the beginning of the element we increase the nesting level, at the end of the element we decrease it
Nesting Level = Nesting Level - 1;
//return the current line one level up
CurrentRow = CurrentRow.Parent;

ElseIf File.NodeType = XMLNodeType.Text Then
//if the element has a value, just save it
CurrentRow.Value = File.Value;

endIf;

EndCycle;

File.Close();

Example 2. Recording a 1C XML file using the 1C Record XML object

//create a file Record XML 1C
File = NewWriteXML();
File.OpenFile("D:\ConfigurationStructure.xml", "UTF-8");
File.WriteElementStart("Configuration");

//use metadata to traverse all directories (for more details, see "Working with metadata")
For each Directory from Metadata.Directories Cycle

//WriteStartofElement - opens a new [subordinate] branch
File.WriteElementStart("Directory");
//WriteAttribute - writes an attribute to a previously opened branch
File.WriteAttribute("Name", Directory.Name);
File.WriteAttribute("Synonym", Directory.Synonym);

//using metadata we go through all the directory details
For each Props from the Directory.Props Cycle




EndCycle;

//use metadata to traverse all tabular parts of the directory
For each PM from the Directory. Tabular Parts of the Cycle
File.WriteElementStart("TabularPart");
File.WriteAttribute("Name", PM.Name);
File.WriteAttribute("Synonym", PM.Synonym);

For each Props from PM.Props Cycle
File.WriteElementStart("Props");
File.WriteAttribute("Name", Attributes.Name);
File.WriteAttribute("Synonym", Attributes.Synonym);
File.WriteEndElement();
EndCycle;

File.WriteEndElement();
EndCycle;

//WriteEndElement - “closes” the branch previously opened using WriteBeginElement
File.WriteEndElement();
EndCycle;

File.WriteEndElement();
File.Close();