Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the itemxml of a selected item in Tridion

I would like to get and display the itemxml of the selected item from the Tridion CME.

I was able to get the Itemxml from my VM server when i give the tcm id in the browser.

However, i would like to get the same information from Tridion GUI Extension.

I am able to get the selected item tcm id. Is there any way to get the itemxml using coreservice?

or is there any other way to get this?

like image 765
pavan Avatar asked Feb 13 '13 06:02

pavan


4 Answers

At the moment there's no way you can get Item XML through core service. Item XML you have seen was provided to you by TCM Protocol handler that might not be there in future versions. If you want to show item XML in CME - take a look at this extention by Yoaw:

http://sdltridionworld.com/articles/sdltridion2011/tutorials/GUIextensionIn8steps.aspx

Also, keep in mind that not all properties of an item might be exposed in Xml, sometimes you have more info in Data object

like image 122
Andrey Marchuk Avatar answered Nov 19 '22 06:11

Andrey Marchuk


Take a look at the PowerTools, it has an ItemXML viewer (written by Robert Curlette) for all items in SDL Tridion

http://code.google.com/p/tridion-2011-power-tools/wiki/ItemXML

The XML is loaded on a tab using JavaScript as follows:

ItemXmlTab.ItemXmlTab.prototype.updateView = function ItemXmlTab$updateView()
{
    if (this.isSelected()) 
    {
        var xslPath = $ptUtils.expandPath("/PowerTools/Client/ItemXml/ItemXmlTab.xslt", true);

        $xml.loadXsltProcessor(xslPath, function (value) 
        {
            var xmlSource = $display.getItem().getXml();

            // Filter out all spacing characters
            xmlSource = xmlSource.replace(/\t|\n|\r/g, "");

            var html = $xml.xsltTransform(value, $xml.getNewXmlDocument(xmlSource), null);

            $dom.setOuterHTML($("#itemXml"), html);
        });        
    }
};

You can view the source code of the extension at http://code.google.com/p/tridion-2011-power-tools/source/browse/#svn%2Ftrunk%2FPowerTools.Editor%2FPowerTools%2FClient%2FItemXml%253Fstate%253Dclosed

like image 34
Chris Summers Avatar answered Nov 19 '22 07:11

Chris Summers


You can get the item XML via CoreService, but this will get you the Tridion R6 (2011) Xml format, which is not the same you would see before.

Sample code available here.

I tend to have a page "GetItemXml.aspx" on my Tcm servers that I then call with a Uri as a parameter, and then this page would return the Item Xml.

like image 2
Nuno Linhares Avatar answered Nov 19 '22 05:11

Nuno Linhares


Article written by Yoav Niran (Url in the post of user978511) is perfect for your requirement.

if you are still facing any issue and in hurry to get it working just perform below steps -

1- Download the extension.

2- Apply the steps 7 and 8 of this article to configure this extension.

like image 1
Ram Saurabh Avatar answered Nov 19 '22 05:11

Ram Saurabh