Jump to content

How to specify a type when is a intger or empty


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...