joecool2005 Posted June 2, 2006 Share Posted June 2, 2006 Hi,This is my xml tag.<taxe>5</taxe><taxe/>How can you define the type in XSD when the taxe is empty or is a integer?thx Link to comment Share on other sites More sharing options...
kgw Posted June 7, 2006 Share Posted June 7, 2006 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 More sharing options...
Zukero Posted July 5, 2006 Share Posted July 5, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now