File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Extending xsd schema with Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Extending xsd schema with "choice" model group" Watch "Extending xsd schema with "choice" model group" New topic
Author

Extending xsd schema with "choice" model group

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8210
    
  71

I am playing with some xsd stuff these days. One of the things i am trying to do is extend an existing xsd to provide more elements in the new one. The base xsd looks like this:


The extended xsd is as follows:




So here i have a "coloursType" with a choice of "red" and "blue" and the extended "more-coloursType" has the additional "dark-red" and "dark-blue". Then in my xml i am trying to do this:



So in the xml, i am trying to use the extended "more-coloursType" and specifying a "dark-red" value. But this fails validation, with a message saying that "dark-red" is not allowed in this place. It starts working if i first have a normal colour (either red or blue) and then have dark-red:



My understanding was with this kind of extension, with the "choice" elements i would have something like:



but this doesn't seem to be the case. Am i missing something? Any changes that i'll have to make to my xsd to allow:



[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Extending xsd schema with "choice" model group
 
Similar Threads
How can I define XML schema for this XML
How to modify XSD that allows XML to hold the base and derived element types in any order?
xml validation failure
Help in creating XML Schema
XML Schema, choice and other stuff