I am creating component using Core Service by having required input in XML file. I am creating component's content XML from XML file using Core Service and setting to component object, same method for component's metadata also, everything works fine as expected except Rich Text Box Field.
For a rich text field, when i try to set a value, I am getting XML validation error.
The value what i am setting is This field is <b>RichText</b> Field
.
The Error is XML validation error. Reason: The element 'componentText' in namespace 'uuid:fca19417-fbed-4008-aab2-213023f0eed2' has invalid child element 'b' in namespace 'uuid:fca19417-fbed-4008-aab2-213023f0eed2'.
When i try to set like this This field is <b xmlns="http://www.w3.org/1999/xhtml">RichText</b> Field
it work's fine.
I understand that i need to pass the namespace as well. I have gone through the lot of questions on the same topic, however all the methods are setting the input text with relevant namespace like what i am setting at the last. But this will be difficult for the business user perspective.
I would like to know how can i handle (html to xhtml) this in best way to add the required namespace before i set the content?