Jump to content

How to specify a type when is a intger or empty


joecool2005
 Share

Recommended Posts

Anybody can solve this problem? I've tried the following but it gives me error. It is said that "Element 'taxe' occurs more than once in the same content model but does not refer to a top-level type definition. Expected type definition 'xs:integer' but got '{no name}'" It seems that you can't have two elements with the same name but different type.

<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">	<xs:element name="root">  <xs:complexType> 	 <xs:choice> 	     <xs:element name="taxe" type="xs:integer"/>     <xs:element name="taxe">   	 <xs:complexType>   	 </xs:complexType>    </xs:element> 	 </xs:choice>  </xs:complexType>	</xs:element></xs:schema>

Link to comment
Share on other sites

  • 4 weeks later...

I think it's impossible and even if it were, it would lead to numerous problems. You just can't define two elements with the same name at the same level. Think about what it would lead to if you then use <xs:element ref="taxe">. There would be no determinist way to know what element it refers to.I wonder if this is even valid XML.Maybe delaring a simpleType owning a union of the two requested type would do the trick, but there is no "empty" type AFAIK in xsd.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...