I use Tridion Core Service (Tridion 2011 SP1) to get a list of keywords for a given category identifier.
CoreService2010Client client = new CoreService2010Client(); XElement xmlCategoryKeywords = client.GetListXml(category.Id, new KeywordsFilterData());
This returns what appears to be a flat XML structure representing our taxonomy, which has 4 depth levels.
The documentation describes an approach to working with this:
var categoryKeywords = xmlCategoryKeywords.Elements().Select(element => element.Attribute("ID").Value).Select(id => (KeywordData)client.Read(id, null) ); foreach (KeywordData keyword in categoryKeywords) { Console.WriteLine("\t Keyword ID={0}, Title={1}", keyword.Id, keyword.Title); }
However, this will only be a list of each keyword. The KeywordData object contains the ParentKeywords property, so you could create a hierarchy in memory.
Is it possible to get XML from a hierarchical core service? Or an easier way to work with this data?
source share