Full XML sample, explained and with all possibilities (version 1.3)

Editions: Ultimate, Enterprise, Campus, Module Media Import
Versionen: 3.6.0+

This article shows and explains an XML file with all possible elements.

Feel free to remove elements that you don´t want to use, but the sequence must be observed.
For example the element

<title></title>

must appear directly before

<description></description>]

The root element wraps all information of your XML:

<mediaimport version="1.3">

...
</mediaimport>

Two containers (XML elements) are elementary:

<locations>...</locations>
Configures locations from where you can import your media. Local directories on your webserver or external FTP, FTPS, SFTP and SCP connections can be configured here. Each medium gets this information with the location attribute. The locations node can be omitted, if all media files of an import job are within the same directory as the XML itself.
<media>...</media>
Within this XML node you define all media that you want to import.

Sample XML for the import:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mediaimport PUBLIC "-//MEDIAIMPORT//DTD MEDIAIMPORT//EN" "http://www.vimp.com/mediaimport-1.3.dtd">

<mediaimport version="1.3">

  <locations>
    <location id="loc1" type="filesystem">
      <path>/path/to/_import/</path>
    </location>
    <location id="loc2" type="ftp">
      <hostname>ftp.server.com</hostname>
      <port>21</port>
      <path>/path/to/_import</path>
      <username>user</username>
      <password>password</password>
      <passive>true</passive>
      <ssl>false</ssl>
    </location>
  </locations>

  <media>
    <medium location="loc1">
      <title>Maestro</title>
      <description>Maestro</description>
      <username>admin</username>
      <publication>public</publication>
      <categories>
        <category>entertainment</category>
      </categories>
      <tags>
        <tag>test</tag>
      </tags>
      <metadata>
        <title>Maestro</title>
        <description>Maestro</description>
        <keywords>Maestro</keywords>
        <author>unknown</author>
        <copyright>unknown</copyright>
      </metadata>

      <!-- media permissions -->
      <permissions>
        <permission>anonymous</permission>
      </permissions>
      <!-- /media permissions -->

      <!-- channel direct upload -->
      <channel>Test-Channel 1</channel>
      <!-- /channel direct upload -->

      <!-- media fields -->
      <fields>
        <field name="required_field">Test</field>
      </fields>
      <!-- /media fields -->
      
      <!-- chapters -->
      <chapters>
        <chapter lang="de">
          <name>Chapter 1</name>
          <description>Chapter 1</description>
          <timecode>00:00:00</timecode>
        </chapter>
      </chapters>
      <!-- /chapters -->
             <files>         <file type="source">abc.wmv</file>         <file type="transcoded">abc.mp4</file>         <file type="transcoded" format="480p">bcd.mp4</file>         <file type="transcoded" format="720p">cde.mp4</file>         <file type="thumbnail">abc.jpg</file>         <html5>           <file type="m4v">abc.m4v</file>           <file type="ogv">abc.ogv</file>           <file type="webm">abc.webm</file>           <file type="mp3">abc.mp3</file>           <file type="oga">abc.oga</file>           <file type="wav">abc.wav</file>         </html5>         <previews>           <file type="transcoded">abc.mp4</file>           <file type="thumbnail">abc.jpg</file>           <html5>             <file type="m4v">abc.m4v</file>             <file type="ogv">abc.ogv</file>             <file type="webm">abc.webm</file>             <file type="mp3">abc.mp3</file>             <file type="oga">abc.oga</file>             <file type="wav">abc.wav</file>           </html5>         </previews>       </files>

    </medium>
  </media>

</mediaimport>

<locations> ... </locations>:

  <locations>

    <location id="loc1" type="filesystem">
      <path>/path/to/_import/</path>
    </location>

    <location id="loc2" type="ftp">
      <hostname>ftp.server.com</hostname>
      <port>21</port>
      <path>/path/to/_import</path>
      <username>user</username>
      <password>password</password>
      <passive>true</passive>
      <ssl>false</ssl>
    </location>

  </locations>

The location element is only needed,

  • if you choose XML in the import dialogue, and upload the xml directly in the VIMP backend
  • or if your media files are not located in the same folder as the XML file itself
  • or, of course, if both applies.

The example shows the most popular locations: a directory in your local filesystem on the webserver (loc1) and an external FTP server (loc2).

Locations explained in detail

<media> ... </media>

Within this node you create a <medium> element for each medium to be imported:

<medium location="location-id"> ... </medium>

The location attribute location="location-id" can be omitted, if no location node exists or if the medium has the same name as the xml file (without file extension).
The medium element is obligatory for each medium to be imported.
<title>Title of the medium</title>
The title element contains the title of the medium.
<username>moderator</username>
This element defines the username of the owner of the medium.
Possible values: username of the user that will be the owner.
<publication>public</publication>
This element defines, if the medium shall be published as public, private or hidden.
Possible values: public; private; hidden
<categories>
  <category>Entertainment</category>
  <category>sCienCe</category>
  <category>9</category>
  <category>Animals</category>
</categories>
Each category requires a new category element within the categories node.
The example above assigns the medium to four categories.
Possible values: category name in one of the installed languages (case insensitive) or category ID.
<tags>
  <tag>Tag1</tag>
  <tag>second tag</tag>
  <tag>third tag</tag>
</tags>
Each tag requires a separate tag element within the tags container
The example adds three tags to the medium.
<metadata>
  <title>Title of the medium</title>
  <description>medium description</description>
  <keywords>keyword1, keyword2, keyword3</keywords>
  <author>Author name</author>
  <copyright>Copyright information</copyright>
</metadata>
Meta tags will be added within the metadata container.
The number of meta tags is limited to the pre-defined tags title, description, keywords, author and copyright.
<permissions>
  <permission>anonymous</permission>
  <permission>administrator</permission>
  <permission>moderator</permission>
</permissions>

VIMP Corporate only: The permissions element defines the access permissions of the medium. Users belonging to a defined role will be able to access the medium in the frontend.
Possible values: name of the user role.
<channel>Mein Channel 1</channel>
<channel>mY ChaNNel 2</channel>
<channel>3</channel>
The channel element enables you to assign a medium to a certain channel directly during import.
Possible values: name of the channel in one of the installed languages (case insensitive) or channel ID.
If the channel element will be omitted, the medium will not be assigned to a channel.
<fields>
  <field name="required_field">Value</field>
  <field name="Feld Name">Value</field>
</fields>
The field elements within the fields container contain values of the custom media fields (see Backend -> Media fields).
The attribute name must contain the unique field name (and not the display name). IDs cannot be used here.
<chapters>
  <chapter lang="de">
    <name>Chapter 1</name>
    <description>Chapter 1</description>
    <timecode>00:00:05</timecode>
  </chapter>
</chapters>
All chapters will be defined within the <chapters>  ...  </chapters>  element.
Each chapter has to be added by a separate chapter node, containing a lang=”xx" attribute for the language (en = English, de = German, etc).
Each chapter requires a <name>Chapter 1</name>, a description <description>Description Chapter 1</description> and the timecode (HH:MM:SS) 00:00:05    <timecode>00:00:05</timecode>.

<files> ...  </files>

The node <files> ...  </files> can be omitted, ifthe to be imported media file has the same file name as the XML file (except of the file extension).

If the XML file name is different to the media file name or if multiple media shall be imported with one XML file, each medium node requires a <files> ... </files> block.

See a sample XML of all possible variations in the following:

      <files>
        <file type="source">abc.wmv</file>         <file type="transcoded">abc.mp4</file>
        <file type="thumbnail">abc.jpg</file>
        <html5>
          <file type="m4v">abc.m4v</file>
          <file type="ogv">abc.ogv</file>
          <file type="webm">abc.webm</file>
          <file type="mp3">abc.mp3</file>
          <file type="oga">abc.oga</file>
          <file type="wav">abc.wav</file>
        </html5>
        <previews>
          <file type="source">abc.wmv</file>
          <file type="thumbnail">abc.jpg</file>
          <html5>
            <file type="mp4">abc.mp4</file>
            <file type="m4v">abc.m4v</file>
            <file type="ogv">abc.ogv</file>
            <file type="webm">abc.webm</file>
            <file type="mp3">abc.mp3</file>
            <file type="oga">abc.oga</file>
            <file type="wav">abc.wav</file>
          </html5>
        </previews>       </files>

Only source file will be imported (transcoding by VIMP):

      <files>
        <file type="source">abc.wmv</file>
      </files>

This code is sufficient, if imported files shall be transcoded by VIMP automatically as it is the case when you upload media regularly in the frontend.

Source file and web formats to be imported (no transcoding):

      <files>
        <file type="source">abc.wmv</file>
        <file type="transcoded">abc.mp4</file>
        <file type="thumbnail">abc.jpg</file> 
      </files>

In case that a node file with the attribute type="transcoded" is set, the medium will not be transcoded. It obtains the status that has been defined at Backend -> Configuration -> Media Import settings > Default Status.

<file type="source">abc.wmv</file>
Source medium. It can be transcoded into all required web formats.
<file type="transcoded">abc.mp4</file>
Transcoded format. mp4 videos can be played in the HTML5 directly without preceding transcoding.
<file type="thumbnail">abc.jpg</file>
Thumbnail. Will be used as preview image and poster image within the player.

Additional formats:

        <html5>
          <file type="m4v">abc.m4v</file>
          <file type="ogv">abc.ogv</file>
          <file type="webm">abc.wen,</file>
          <file type="mp3">abc.mp3</file>
          <file type="oga">abc.oga</file>
          <file type="wav">abc.wav</file>
        </html5>

Additional formats will be defined in the <html5> ... </html5> node. For videos, type=”m4v” should be sufficient for all modern mobile devices.

With the video on demand extension enabled, required preview videos can be imported as well:

        <previews>
          <file type="transcoded">abc.mp4</file>
          <file type="thumbnail">abc.jpg</file>
          <html5>
            <file type="m4v">abc.m4v</file>
            <file type="ogv">abc.ogv</file>
            <file type="webm">abc.webm</file>
            <file type="mp3">abc.mp3</file>
            <file type="oga">abc.oga</file>
            <file type="wav">abc.wav</file>
          </html5>
        </previews>

 
As you can see, you have full control of all required formats. Alternatively, you can always just import the source files and let VIMP take care of the transcoding of the additional web formats.

Last update on 2021/11/30 by Admin.

Go back