I have a question regarding the XML Schema type.
The type has to be:
text, allowing embedded HTML formatting
what should I use to do this? (allowing embedded HTML formatting? I think for text xsd:string for example would be fine but I don’t know what to do to allow embedded HTML formatting)
What should I include in this case?
The
xs:stringdatatype is really not suitable for character data interspersed with markup; that is what complex types withmixed="true"are for.If you’re writing an XSD schema for a document type and want a particular element to be able to contain arbitrary XHTML elements, the right way to declare it is something like this:
This won’t allow the HTML to consist of tag salad; the HTML will need to be well formed (i.e. be encoded as XHTML). If for whatever reason you believe you need to allow tag salad as the content of
embedded_html, then your choices are to reconsider what you actually need or to do as some other vocabularies do and escape the HTML encoding. But even in that case, I think you’ll do better to use mixed content thanxs:string.