Vidar
Vidar

Reputation: 6673

Design decision - Almost Identical XSDs

I have an XSD - it is designed to allow clients to my webservice to send XML data in a structured and robust way (that's the whole point of XSDs right?).

However I am designing some other part of the system and was going to use this XSD because it does 99.999999% of what I need it to do - it has all the data I could ever want - except it is missing an element that I need it to hold - a database primary key value.

So you may be thinking - whats your problem, just add the element to the XSD and get on with it! Well yes I could, but the problem is - the client side of the system would not know what to do with this element (leave it blank??), - they don't have to put in a primary key value in, actually impossible for them to do so! - makes sense really, if you are sending data to the database, its the database that makes the primary key value, not the person sending it.

So what do I do? Do I make 2 almost identical XSDs (one with a primary key value element, and one without) or just try and 'shoehorn' everything into one XSD, but as a side effect cause possible confusion?

Upvotes: 0

Views: 58

Answers (1)

Mark Dickinson
Mark Dickinson

Reputation: 6633

Can't you use inheritance, see this article. Then you can create a second xsd that references the first and adds the field you need.

Upvotes: 2

Related Questions