I can see there is an overridable function public override void ReadFromXhtmlElement(XmlElement xhtmlElement) available in MediaItem class.

I have overrided this function in my child class. But nothing happened with this overriding. Can any one tell me from where this method is being called and why it is not functioning after overriding in inherited class?

I am using DXA 1.4 with Web 8.

1 Answer 1


That method is only called when an Entity Model is "inflated" from a Rich Text Field.

To clarify: DXA supports Media Items embedded in a Rich Text field (most obvious: embedded Images, but any kind of Media Item can be embedded). If a Rich Text field contains embedded Media Items, DXA creates Entity Models for those Media Items when processing the Rich Text field. These Media Item can initialize themselves from the data in the XHTML; the RichTextProcessor instantiates an appropriate MediaItem subclass and the calls its ReadFromXhtmlElement method.

See https://github.com/sdl/dxa-web-application-dotnet/blob/master/Sdl.Web.Tridion/Mapping/DefaultRichTextProcessor.cs

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.