Question

I am trying to add a processing instructions to my xml file in the source view of component xml. For example:

<?altova_sps C:\Users\src\sps\2012\spsfile.sps?>
<my_element xmlns="uuid:8d903098-e607-4d96-90a7-14d2d188dab7">
  ...
</my_element>

After I click on Save, Tridion CME automatically removed the processing instruction. Is there a way to change this behavior?

(I want to add the processing instruction so that I can open the xml file with XMLSpy in Authentic View using WebDAV)

Was it helpful?

Solution

I have researched this a bit, and I am not convinced this can be done from within the CMS. However you can probably achieve this by creating an HTTPModule or Proxy or some form which transforms the requests and responses made to the /webdav directory of the CME.

Conceptually when a request is made by XMLSpy, the new module would pre-pend the desired instruction to the XML based on the item being a Component and the Schema it is based on. Then when you save (POST) the data back it would need to strip it out again. This would leave the XML structure in the format that SDL Tridion requires.

Hope that helps

Chris

OTHER TIPS

I am posting this as an idea - although I can't get it do do quite what you want. I have written an EventHandler to manipulate the XML recieved by XMLSpy (and all clients including the CME at this point)

using System;
using System.Text;
using System.Xml;
using Tridion.ContentManager.Extensibility.Events;
using Tridion.ContentManager.Extensibility;
using Tridion.ContentManager.ContentManagement;
using System.IO;

namespace UrbanCherry.Net.SDLTridion.EventHandlers
{
    [TcmExtension("AppendAuthenticHeaders")]
    public class AppendAuthenticHeaders : TcmExtension
    {
        public AppendAuthenticHeaders()
        {
            Subscribe();
        }

        public void Subscribe()
        {
            EventSystem.Subscribe<Component, LoadEventArgs>(AppendAuthenticHeader, EventPhases.Processed);
        }

        private void AppendAuthenticHeader(Component source, LoadEventArgs args, EventPhases phase)
        {
            if (source.ComponentType != ComponentType.Multimedia)
            {
                XmlDocument newXml = new XmlDocument();
                newXml.LoadXml("<?altova_sps C:\\Users\\src\\sps\\2012\\spsfile.sps?>" + source.Content.OuterXml);
                source.Content = newXml.DocumentElement;
            }
        }


    }
}

I tried manipulating the output (by replacing a string), and it does show up in XMLSpy via WebDAV. The problem I have is that adding the processing instruction falls outside of the DocumentElement, so never makes it into the new XML.

So I know this does not solve your challenge - but perhaps someone else knows of an event which would allow you to append the instruction when the XML is loaded via the WebDAV cartridge in a similar manner.

Hope someone else can help you close this - I will dig a little more if I have time

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top