I want to validate the following XML through schema where it should not be validated if there is no text inside the l10n
element. Also the content element is mandatory for the XML. Please someone suggest me the relevant answer.
The XML to validate would be:
<body xmlns="http://iddn.icis.com/ns/test">
<content>
<l10n xml:lang="en"></l10n>
</content>
</body>
The schema I am currently using is as follows but it is still allowing the above XML to be validated.
<xs:schema elementFormDefault="qualified" targetNamespace="http://iddn.icis.com/ns/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:conf="http://iddn.icis.com/ns/config"
xmlns="http://www.w3.org/1999/xhtml">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
</xs:import>
<xs:simpleType name="nameType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="content">
<xs:complexType mixed="true">
<xs:sequence>
<xs:any maxOccurs="unbounded" minOccurs="0" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="i18n-value">
<xs:sequence>
<xs:element name="l10n" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="nameType">
<xs:attribute ref="xml:lang" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="body">
<xs:complexType>
<xs:sequence><xs:element ref="content"></xs:element></xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>