Skip to main content
added 4 characters in body
Source Link
Rick Pannekoek
  • 21.4k
  • 1
  • 18
  • 30

Your question/problem is not specific to Tridion, but a general question on how to deserialize XML mixed content using the XmlSerializer. Note that the content of a "rich text field" (a.k.a. XHTML field) is mixed content in XML. That is: it is text content mixed with XML elements from the XHTML namespace. You

You currently map the "Body" field to a property of type String; the XmlSerializer doesn't expect mixed content in that case (I see you're already trying to bypass serialization issues by putting the content in a CDATA section in the property getter, but that is not compatible with how Tridion represents the XHTML content and it's not solving your deserialization issue either). I'm

I'm not sure if it's possible to let the XmlSerializer (de-)serialize such mixed content; you could try changing the type of the Body property to XmlElement.

Your question/problem is not specific to Tridion, but a general question on how to deserialize XML mixed content using the XmlSerializer. Note that the content of a "rich text field" (a.k.a. XHTML field) is mixed content in XML. That is: it is text content mixed with XML elements from the XHTML namespace. You currently map the "Body" field to a property of type String; the XmlSerializer doesn't expect mixed content in that case (I see you're already trying to bypass serialization issues by putting the content in a CDATA section in the property getter, but that is not compatible with how Tridion represents the XHTML content and it's not solving your deserialization issue either). I'm not sure if it's possible to let the XmlSerializer (de-)serialize such mixed content; you could try changing the type of the Body property to XmlElement.

Your question/problem is not specific to Tridion, but a general question on how to deserialize XML mixed content using the XmlSerializer. Note that the content of a "rich text field" (a.k.a. XHTML field) is mixed content in XML. That is: it is text content mixed with XML elements from the XHTML namespace.

You currently map the "Body" field to a property of type String; the XmlSerializer doesn't expect mixed content in that case (I see you're already trying to bypass serialization issues by putting the content in a CDATA section in the property getter, but that is not compatible with how Tridion represents the XHTML content and it's not solving your deserialization issue either).

I'm not sure if it's possible to let the XmlSerializer (de-)serialize such mixed content; you could try changing the type of the Body property to XmlElement.

Source Link
Rick Pannekoek
  • 21.4k
  • 1
  • 18
  • 30

Your question/problem is not specific to Tridion, but a general question on how to deserialize XML mixed content using the XmlSerializer. Note that the content of a "rich text field" (a.k.a. XHTML field) is mixed content in XML. That is: it is text content mixed with XML elements from the XHTML namespace. You currently map the "Body" field to a property of type String; the XmlSerializer doesn't expect mixed content in that case (I see you're already trying to bypass serialization issues by putting the content in a CDATA section in the property getter, but that is not compatible with how Tridion represents the XHTML content and it's not solving your deserialization issue either). I'm not sure if it's possible to let the XmlSerializer (de-)serialize such mixed content; you could try changing the type of the Body property to XmlElement.