Schema and derived types
-
I'm trying to create a list containing subtypes of an abstract type in xml and validate it using an xml schema I tried to use this as a schema but when i try to validate i get an error telling me that I cannot use transaction because it's marked abstract. Basically I'm trying to end up with a list that contains transaction nodes some of which are of type transaction1 and some are transaction2.
The code above is only for testing, I'm trying to get my head round how restriction etc works in schema. Does anyone know how to do this? Cheers, Russell
-
I'm trying to create a list containing subtypes of an abstract type in xml and validate it using an xml schema I tried to use this as a schema but when i try to validate i get an error telling me that I cannot use transaction because it's marked abstract. Basically I'm trying to end up with a list that contains transaction nodes some of which are of type transaction1 and some are transaction2.
The code above is only for testing, I'm trying to get my head round how restriction etc works in schema. Does anyone know how to do this? Cheers, Russell
From what I can see, you have a couple of problems: * Everything is in lower-case, so complextype is not the same as the (correct) complexType. (This also applies to complexcontent/complexContent, etc) * The complexType 'transactions' contains a sequence that contains a choice. You cannot limit a choice in this way. Here is the right way: So I removed the choice to get it to work. For reference, here is what the final schema looks like: