13

Is it possible to define a Multimedia Type of type "XML"? When I try to define such a multimedia Type, it gives an error:

It is not possible to use file extension 'xml': it is reserved by the system.

But I need to upload binary files of xml type.

2 Answers 2

12

It is not possible to define a Multimedia Type with the extension xml, as this is a reserved extension for Components, exposed through WebDAV (mind you an XML file is not a binary file, it is a text based file).

There are two workarounds (or solutions depending on how you see it).

  1. Create a Schema for the XML you wish to upload and use a (normal) Component instead.
  2. Use a different extension (which you might consider to replace with XML in a Storage Extension).

I would consider option 1, a real solution and option 2, a workaround (or hack), but that is all depending on how you see it of course.

Main thing to mention for option 1 is that is usually is very simple to create the Schema for your XML by using tools like XML Spy which can generate the Schema based on the XML. This Schema you can then paste in the source tab of a SDL Tridion Schema and have it validated. If it is a valid W3C Schema it will be accepted as a Complex Schema, which means that you don't see the Design tab in the Schema anymore, and in the Component you won't have the General tab. The XML has to be pasted directly in the Source tab on the Component or you can use WebDAV to upload your XML (into a Component) by simply dragging and dropping your XML in the WebDAV folder.

(btw. you could be lucky if your XML structure is simple enough to fit in a Tridion Web Schema, then you can use all the editing features of the UI).

3
  • 1
    I wouldn't call these workarounds. XML is a natively supported type in Tridion. Why would anyone want to make it a binary? Commented Mar 21, 2013 at 20:26
  • Because sometimes people don't want XML that validates against a schema?
    – Nuno Linhares
    Commented Mar 21, 2013 at 20:48
  • 1
    w3.org/TR/xmlschema-0/#any Commented Jun 24, 2013 at 17:20
7

I've seen a third approach (to add to Bart's answer), which is to store the XML markup as plain text in a normal components' plain text field. This can be further enhanced with Custom URL functionality to create a popup page with a file upload dialog from which javascript logic will take the XML file and automatically paste the contents into the plain text field.

With this approach you will need to have a component template which renders the XML and a corresponding page template with a .xml extension to publish an XML page. Note, with this approach it is necessary XML-decode contents back unescaped characters since Tridion will escape them(i.e. '<' to '&lt;' need to be converted back to '<').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.