I stuck with the following conversion from DTD:
<!ELEMENT contact (name+, ((email | phone+) | (email, phone+)), address?)>
to XSD:
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="name"/>
<xs:choice>
<xs:choice>
<xs:element ref="email"/>
<xs:element maxOccurs="unbounded" ref="phone"/>
</xs:choice>
<xs:sequence>
<!-- Next line causes exception -->
<xs:element ref="email"/>
<xs:element maxOccurs="unbounded" ref="phone"/>
</xs:sequence>
</xs:choice>
<xs:element minOccurs="0" ref="address"/>
</xs:sequence>
</xs:complexType>
I get 'Multiple definition of element 'email' causes the content model to become ambiguous.' exception. What I do wrong? any suggestions to overcome
The DTD content model is ambiguous, so the converter has generated an ambiguous content model in the schema. Both DTD and XSD prohibit ambiguous content models.
"Ambiguity" here is a technical term, it means that when an "email" element is found in the input, it can't tell which branch of the choice to take. There are different kinds of ambiguity - some can be resolved by lookahead, others can't; but that's irrelevant here. If you feed a bad DTD into the converter, you will get a bad schema out.
In this particular case, removing the ambiguity is trivial, just change the content model to
<!ELEMENT contact (name+, email, phone+, address?)>
In the more general case, removing ambiguities is a difficult (but solved) problem in computer science.