How to create an XML to import files and tags in Tabbles 4

 

 

Suppose you have tagged some files with an external tool, and want to import the tagging done into Tabbles 4.

One way to do this would be to directly write in the SQL database used by Tabbles. Another way to do this is to create an XML file in a format that is understood by Tabbles, and then, from within Tabbles, choose

File -> Database -> Import database from XML zipped.

This guide allows you to create an XML file containing tagged files and that can be imported into Tabbles 4.

 

The basic template

 

Conceptually, your XML file must define:

  1. Tag colors
  2. Tags
  3. Files

You can start by pasting the following template into a text editor:

<?xml version=”1.0″ encoding=”utf-8″?>

<tabbles_db_root version=”5″ creation_date=”12/13/2016 18:27:26″ encrypted=”False” color_generic=”9517″ tabble_workspace=”_workspace_tag” tabble_comp=”_computer_tag” tabble_fav=”_favorites_tag”>

<categories>

<category cat_id=”9517″ cad_cat_color=”#FFE7E8EF” />

<!– PUT COLORS HERE –>

</categories>

<tabbles>

<!– PUT TAGS HERE –>

</tabbles>

<favorite_folders>

</favorite_folders>

<extension_tabbles />

<urls />

<gens />

<files>

<!– PUT FILES HERE –>

</files>

<rules>

</rules>

</tabbles_db_root>

 

As you can see, the template has 3 “holes” which you will have to fill: one hole for tag colors, one for tags, and one for files.

 

Defining colors

 

To define a color you can add an element inside the <categories> element, as follows:

<category cat_id=”9518″ cad_cat_color=”#FFFFFF22″ />

The cat_id can be any unique number (different from 9517 which is the default color), and the color can be any color in hex format (ARGB).

You can add more than one color if you like.

Your tags, as you will see below, will have to refer to the correct color by using the correct cat_id.

 

Defining tags

 

For each tag you want to define, you need to add a “tabble_normal” element as child of the <tabbles> element:

<tabble_normal name=”TestTag2” adl_cat2=”9518“>

<adl_files>

<!– PUT the files with that tag here –>

</adl_files>

<adl_urls />

<adl_gens />

<common_data cdInWorkspace=”True” cd_usage_count=”0″ cd_creation_date=”12/13/2016 18:27:26″>

<parent name=”_workspace_tag” />

</common_data>

</tabble_normal>

In the above, replace TestTag2 with the name of your tag. Replace 9518 with the correct color id (of course you must have created a color with that id in the previous section).

If the tag has files associated (which is likely), you need to put one or more “file” elements as children of the <adl_files> element, as follows:

<file f_is_dir=”false” f_path=”C:\Users\mau2\temp\test-file2.txt” machineName=”PC-GRANDE” organization=”333” />

In the above:

f_is_dir must be true or false depending on whether the file is a directory or not.

f_path must of course be the full file path.

machineName must be the machinename of the current machine (or the machine where the file is).

organization can be any number you want, but you must be careful to use the same number throughout the file. (also in the “org” attribute of the “file” element, which you will encounter later.)

For example, if the tag TestTag2 has only one file, you will write:

<tabble_normal name=”TestTag2″ adl_cat2=”9518″>

<adl_files>

<file f_is_dir=”false” f_path=”C:\Users\mau2\temp\test-file2.txt” machineName=”PC-GRANDE” organization=”333″ />

</adl_files>

<adl_urls />

<adl_gens />

<common_data cdInWorkspace=”True” cd_usage_count=”0″ cd_creation_date=”12/13/2016 18:27:26″>

<parent name=”_workspace_tag” />

</common_data>

</tabble_normal>

 

Defining files

 

Tabbles’ XML format also requires you to define files (even if this could seem redundant, because they could be derived from the tags defined above).

For each file you want to import, you need to add a “file” element as a child of the “files” element:

<file f_path=”C:\Users\mau2\temp\test-file2.txt” machineName=”PC-GRANDE” org=”333

f_is_dir=”false” fid_usage_count=”0″>

<fid_tabbles>

<!– put the tags of the file here –>

</fid_tabbles>

</file>

In the above:

f_path is the full path of the file, and must be the same you defined in the previous section;

f_is_dir must be true or false depending on whether the file is a directory;

machineName must be the machinename of the current machine (or the machine where the file is);

org must be the same number you used in the previous section (it identifies your organization).

If your file has tags (which is likely), you need to put one or more “tabble” element as a child of the “fid_tabbles” element. For example:

<tabble tname=”TestTag2” />

This must of course be coherent with what you have specified in the “tabble_normal” section.

In particular, “tname” must be the name of a tag you defined in the previous section.

 

Complete example

 

Here is a complete XML file which defines only one tag (TestTag2) and only one file, and associates the file with the tag.

<?xml version=”1.0″ encoding=”utf-8″?>

<tabbles_db_root version=”5″ creation_date=”12/13/2016 18:27:26″ encrypted=”False” color_generic=”9517″ tabble_workspace=”_workspace_tag” tabble_comp=”_computer_tag” tabble_fav=”_favorites_tag”>

<categories>

<category cat_id=”9517″ cad_cat_color=”#FFE7E8EF” />

<category cat_id=”9518″ cad_cat_color=”#FFFFFF22″ />

</categories>

<tabbles>

<tabble_normal name=”TestTag2″ adl_cat2=”9518″>

<adl_files>

<file f_is_dir=”false” f_path=”C:\Users\mau2\temp\test-file2.txt” machineName=”PC-GRANDE” organization=”333″ />

</adl_files>

<adl_urls />

<adl_gens />

<common_data cdInWorkspace=”True” cd_usage_count=”0″ cd_creation_date=”12/13/2016 18:27:26″>

<parent name=”_workspace_tag” />

</common_data>

</tabble_normal>

</tabbles>

<favorite_folders>

</favorite_folders>

<extension_tabbles />

<urls />

<gens />

<files>

<file f_path=”C:\Users\mau2\temp\test-file2.txt” machineName=”PC-GRANDE” org=”333″ f_is_dir=”false” fid_usage_count=”0″>

<fid_tabbles>

<tabble tname=”TestTag2″ />

</fid_tabbles>

</file>

</files>

<rules>

</rules>

</tabbles_db_root>

Import: if you try to import this file on your computer, you will see the tag TestTag2 created, but you will not the file in the tag, because your machinename of your computer will probably not be “PC-GRANDE”.

Should you have problems with this guide, feel free to contact us at bugs -at- tabbles.net.