Manually editing files

Manually editing files

Manually editing files

When working with Valentina files in general, and measure files in particular, there are times when restrictions, either intentional or due to software limitations, prevent the necessary changes from being made. In these cases, the solution is to edit the files manually.

All Valentina’ file formats are based on plain text files in XML format. This means that to edit them you only need to open the files with an ordinary text editor. A very simple text editor is not good for this; you can still view the file, but you will not get the convenience of editing it. It is therefore advisable to install a program that meets the following requirements:

  • Allows you to number the lines of the document. This is important, as it allows you to quickly find the correct line when you are correcting mistakes. Valentina is a very frequently reporting issue location.
  • Has syntax highlighting. A very important feature which is still underestimated by many people. Syntax highlighting in a separate colour helps to analyse the structure of the file.
  • Automatic formatting. If the file you receive is poorly formatted, it will affect the usability of the file. Normally, Valentina files are formatted correctly by default, but this can be important for working with other formats.
  • Syntax check. In order to work with any file you need to understand how it works. It is therefore very important to understand these principles when editing files. The Syntax Checker will check and point out formatting errors in XML.

There are other helpful and less helpful features that can help you with your files.

You should always make backups of your files before making changes.

There are some common reasons why you will need to edit files manually:

  • Error correction. There are two types of errors of this nature. The first has to do with the file structure itself, and the second has to do with incorrect data. In both cases, Valentina will not be able to finish reading the file successfully and you will need to edit the file manually.
  • Manual file editing. In this case, your goal is to bypass the limitation of the program. For example, transferring increments from another file. Moving an operation up or down in the history. Or editing the parameters of a multi-dimensional table.

Whatever your goal, there are two things you should always understand:

  • How the XML format works.
  • How a particular file format is organised.

Let’s take editing a multidimensional measures file as an example. What if you make a mistake after creating a multidimensional measurement file, and you want to change the table measurements, and Tape won’t let you do it? That’s right, open the file and make the necessary changes manually. This limitation is intentional. Because any editing of the measurements is meaningless and would skew the result completely, it was decided not to offer this feature in the program. You must take extra responsibility for such changes, so they must be done with great care and understanding.

First, open the multidimensional measures file in your text editor and try to understand what it consists of. If you do not have a suitable file, you can go to our collection of multisize measures and download the evaluation version there. That should be enough to experiment with. Some of the blocks should be easy to guess, while the purpose of the others will remain unknown. But before we start editing, we should learn how XML works.

This markup language is based on very simple principles. There are very few things you need to know to be able to manipulate files. The first is tag. A tag allows you to identify data and organize it. The general scheme for a tag is very simple. It’s got a sign for less (<), a name and a sign for more (>). For example, <version>. There are two ways to write tags: single and double. Single tags are preceded by a “/” in front of the closing character. For example, the dimension constraint <restriction coordinates="158;44" min="36" max="39" exclude="37;38" /> is a single tag. In a double entry, each tag is a pair - opening and closing. This is usually where beginners make their mistake. By mixing them up or using twice the opening or closing tag. An example of such a tag would be information about the units of a table <unit>cm</unit>.

XML markup also supports describing more complex data structures. For this purpose tags may be nested inside each other. A tag on a level above is considered the parent, and a nested one the child. Tags on the same level are called siblings, or neighbours. An example of such a block would be the dimensions section we are interested in.

<dimensions fullCircumference="true">
    <dimension base="176" type="x" min="158" max="200" step="6"/>
    <dimension base="44" type="y" circumference="true" min="42" max="66" step="2"/>
    <dimension base="45" type="w" min="33" max="63" step="1"/>

The last important feature we need to learn about is attributes. This is an alternative way of recording data in a tag. It exists in the form of a key and a value pair. A tag can have from zero to infinity attributes. The value of a tag is always written in quotes. Only allowed attributes can be added.

So, since we are already familiar with such concepts as tag and attribute, we can begin to get acquainted with the block we are interested in.

<dimensions fullCircumference="true">
    <dimension base="176" type="x" min="158" max="200" step="6"/>
    <dimension base="44" type="y" circumference="true" min="42" max="66" step="2"/>
    <dimension base="45" type="w" min="33" max="63" step="1"/>

This block describes the dimensions, as indicated by its name. The fullCircumference attribute indicates that the dimension values are to be output as full circumferences. The values are always written in the file with half a circumference. Therefore we ask the program to take this into account for ease of use. The next step is a block of three tags. Each of them describes a dimension. There can be from one to three tags. Each dimension is described by a list of attributes:

  • base - base value for that dimension.
  • type - type of dimension. Valid values are x (height), y (chest circumference or size), z (hip circumference), w (waist circumference).
  • min - minimum dimension value.
  • max - maximum dimension value.
  • step - offset step of the dimension value.
  • circumference - indicates that the value is a circumference and not just a size. This affects the available dimension values.

Separately, here is an example of a description of the dimension labels.

<dimension base="44" type="y" circumference="true" min="44" max="62" step="2">
        <label value="44" label="88 (От 66)"/>
        <label value="46" label="92 (От 70)"/>
        <label value="48" label="96 (От 74)"/>
        <label value="50" label="100 (От 78)"/>
        <label value="52" label="104 (От 82)"/>
        <label value="54" label="108 (От 86)"/>
        <label value="56" label="112 (От 90)"/>
        <label value="58" label="116 (От 94)"/>
        <label value="60" label="120 (От 98)"/>
        <label value="62" label="124 (От 102)"/>

Here, everything should be clear without words. There is a block of labels, each label describes a value (half circumference) and the text of the label to be shown instead of a digit.

That’s all. If you want to extend the range of dimension values, simply edit the min or max attributes. Do not forget to take the step into account when doing this. To change the base value, edit the base attribute. Don’t forget that you will need to correct the values for all measures.

If you follow the simple enough rules, the process itself will not cause any problems. With a little practice, you will find the description easy.


No comments yet.

Post your comment