Search code examples
tridiontridion-2011

how to get XML Structure of any object in SDL Tridion


How do I get the XML structure of an item in Tridion (like Schema, Component, Compound Template, Keywords, Categories, Folders etc)?

Does it lies in the installation folder of Tridion or anywhere else? Or is there any way to access it from Tridion UI Directly?


Solution

  • Here is the simplest snippet you can run in browser console to achieve that:

    var itemUri = "tcm:...";
    var item = $models.getItem(itemUri);
    if(item)
    {
       if(item.isStaticLoaded())
       {
          console.log(item.getStaticXml());
       }
       else
       {
          $evt.addEventHandler(item, "staticload", function() {
             console.log(item.getStaticXml());
          });
         item.staticLoad();
       }
    }