wood burning stoves 2.0*
The moose likes Product and Other Certifications and the fly likes XML schema question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Reply locked New topic
Author

XML schema question

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi, all:

I have two complex types:

<xs:complexType name="type1">
<xs:all>
<xs:element name="A"/>
<xs:element name="B"/>
</xs:all>
</xs:complexType>

<xs:complexType name="type2">
<xs:all>
<xs:element name="C"/>
<xs:element name="D"/>
</xs:all>
</xs:complexType>

I want another type which is the union of type1 and type2. Of course I can do this:


<xs:complexType name="type3">
<xs:all>
<xs:element name="A"/>
<xs:element name="B"/>
<xs:element name="C"/>
<xs:element name="D"/>
</xs:all>
</xs:complexType>


But I wanna use type 1 and type2 to define type3. I don't wanna retype all these elements (there may be many elements). How to do it? union can only be used for simpleType?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Hello "Al Bundy",

First of all, please take a minute for reading our naming policy and adjust your display name accordingly -- no obviously fake names, please.

Second, please don't cross-post. I'm closing this thread; the discussion should be continued in the XML forum instead.

Thanks.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML schema question
 
Similar Threads
schema allowing elements to appear in any order
Help, gurus, XML schema question
how to use xs:all with xs:extension?
xsd:all element
XML valiadation using schema