The value of any <property> element should be validated depending on the type attribute's value. Additionally, I would like to use existing schema primitives such as int, string and boolean. My current approach for the definition of a tile's property looks like this:
I'm using XMLSpy 2004 which validates the files before saving, and trying to save doesn't produce an error. However, if I try to switch to a graphical representation of my schema(there is a text view and several more graphical, a bit UML like views), I get the following error: Unable to show schema: The element xs:simpleType is unexpected at this location. And the line "<xs:simpleType>" after "<xs:restriction base="etg:TilePropertyType">" in the complexType String is marked.
Is this a bug of XMLSpy(i suppose not) or is my schema really not valid and XMLSpy doesn't check everything when saving? If my schema is invalid, how could I correct it(with the same functionality) to make it valid?
What I'm doing is basically trying to have two supertypes: TilePropertyType and, in this example, xs:string. Is this possible in XML schemas?
Thanks for your answer. It's hard to explain, so I'll post the full definition of "TileType". I guess this is the easiest way.
I'm using the abstract type TilePropertyType as a placeholder for TilePropertyType's subtypes String, Int, Boolean. I don't want to do the validation of e.g. int myself so I first extend TilePropertyType and then extend xs:int which does the validation for me(the validation works, actually). [ September 30, 2004: Message edited by: Michael Herrmann ]
Joined: Jun 03, 2000
Ok, to clarify what XMLSpy is doing, this is what I think -
When you save the file, it checks for 'well-formdness' since the XSD is also an XML file. Once its well-formed, it allows save. When you try to switch to a graphical/tree view, it is trying to build your element definitions and runs into trouble because the definition is not correct.
I am trying narrow what is wrong with the definition. I don't have a lot of experience with Schemas, still learning. Thanks.
subject: [XML Schema] same elementname, different attributes