How to get the itemxml of a selected item in Tridion
Asked Answered
D

4

5

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?

Dispirited answered 13/2, 2013 at 6:52 Comment(0)
R
5

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

Ramentum answered 13/2, 2013 at 7:58 Comment(0)
O
4

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

Opheliaophelie answered 13/2, 2013 at 11:59 Comment(0)
F
2

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.

Fuzee answered 13/2, 2013 at 11:5 Comment(0)
F
1

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.

Fuss answered 18/2, 2013 at 6:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.