I need to restrict the elements in xml file to be non empty using xsd files. Can I force the elements to contain only CDATA sections?Answer1:
The only tool you have is the xs:string pattern restriction as in below. CDATA is just an alternative to escaping with entity references. You should use entity references in your pattern.
<simpleType name="NewType2"> <restriction base="string"> <minLength value="5"></minLength> <maxLength value="30"></maxLength> <pattern value="(<html>).*(</html>)"></pattern> </restriction> </simpleType>