I'm currently working on the process of importing specific elements of legacy Tridion data (held within R5) into Tridion 2013 via the Core Service, and I've got a simple test pretty much up and running. I can create the components and get the data that I've extracted from R5 in there as I need to, however I'm encountering issues when dealing with Rich Text Fields - Tridion is encoding the HTML tags within the content I'm passing through.

So content like this:

<p>While this beautiful parc has a tranquil atmosphere, it also offers you plenty to do. A giant wave pool and an 18 hole golf course are just two of the attractions.</p>


&lt;p&gt;While this beautiful parc has a tranquil atmosphere, it also offers you plenty to do. A giant wave pool and an 18 hole golf course are just two of the attractions.&lt;/p&gt;

As a result of this, the data isn't ending up in the component in a usable format. Editors would have to go in and manually correct the data, which kind of defeats the point of the import process!

I've tried inserting it as CData and also as a string validated through Tidy.NET (which I found as a suggestion here: http://nunolinhares.blogspot.co.uk/2011/06/importing-content-into-tridion.html), but I get the same behaviour no matter what I do. I can inspect the component object that I'm passing to the CoreService and know from that that the HTML is unencoded when it's passed through - so there must be something on the Tridion end that's playing with it.

Would anyone know whether I'm missing something, or whether something specific needs to be done in order to stop Tridion from encoding the data passed to it - so that I can get the paragraph markup inserted directly into the Source of the RTF "as is"? The code I'm using follows:

Tridion.ComponentData component;
component = client.GetDefaultData(Tridion.ItemType.Component, "tcm:20-104-2", null) as Tridion.ComponentData;
component.Title = "testimport component";
component.Id = "tcm:0-0-0";
component.Content = newSite.Serialize();
component.Schema.IdRef = "tcm:20-606-8";

    client.Create(component, null);
    phResult.Controls.Add(new LiteralControl("Successfully created component!"));
catch (Exception ex)
    phResult.Controls.Add(new LiteralControl("Error: " + ex.ToString()));

Any help would be very much appreciated!

  • What exactly is newsite for an object and do you actually need to call .Serialize() on it? Sep 13, 2013 at 13:34
  • Yep, newsite.Serialize() is the function we expect to generate the component XML along with your RTF /xhtml field. Share this code. Sep 13, 2013 at 13:42
  • "newSite" is just an instance of a "Site" component - basically "Site"'s are what I'm trying to create in Tridion! As for why I'm calling the Serialize() function, I'm following the BuildingBlocks blog entry for importing data using XML Serialization/Deserialization - found here: building-blocks.com/thinking/… - which is why that's there! Sep 13, 2013 at 13:46
  • 1
    My first guess would be that newsite.Serialize() returns the encoded HTML already, while it should just be the OuterXml of XmlDocument.DocumentElement with XHTML as child elements for the RTF field. Sep 13, 2013 at 13:50
  • Jon, how did you get on with this? Did you opt for Nuno's suggestion or fix the serialisation?
    – Neil
    Mar 11, 2014 at 13:53

1 Answer 1


On my Import Content from RSS project I am using Frank van Puffelen's excellent Fields class to deal with content formats, never had trouble with it. Might be worth taking a look there.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.