Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 27th, 2013, 12:05 PM
imchi imchi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 171 imchi User rank is Sergeant (500 - 2000 Reputation Level)imchi User rank is Sergeant (500 - 2000 Reputation Level)imchi User rank is Sergeant (500 - 2000 Reputation Level)imchi User rank is Sergeant (500 - 2000 Reputation Level)imchi User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 5 h 37 m
Reputation Power: 26
XML schema redesign

Hi,

I have a web service that allows this kind of elements in the request (simplified):

Code:
<xs:complexType name="Foo">
    <xs:all>
        <xs:element name="A" type="typeA"/>
        <xs:element name="B" type="typeB"/>
        <xs:element name="C" type="typeC"/>
    </xs:all>
</xs:complexType>


We use JAXB to automatically compile the XSDs and generate all necessary Java classes.
Now I have to allow operations on the elements of this type:

Code:
<xs:complexType name="Foo">
    <xs:all>
        <xs:element name="A" type="typeA"/>
        <xs:element name="D" type="typeD"/>
    </xs:all>
</xs:complexType>


But also I must allow the client code to continue using the legacy objects as described in the first listing.
How do I design the schema element to allow both options? I have been trying to do something like this:

Code:
<xs:complexType name="Foo">
    <xs:all>
        <xs:element name="A" type="typeA"/>
        <xs:choice>
            <xs:all>
                <xs:element name="B" type="typeB"/>
                <xs:element name="C" type="typeC"/>
            </xs:all>
            <xs:element name="D" type="typeD"/>
        </xs:choice>
    </xs:all>
</xs:complexType>


But then the XSD compiler fails because you cannot have xs:all inside xs:choice.
I've read about substitution groups too, but that seems to apply only to element names.
What's the right way to go here?
Thanks.

Reply With Quote
  #2  
Old May 8th, 2013, 05:19 AM
cygnetinfotech cygnetinfotech is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2013
Posts: 13 cygnetinfotech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 39 sec
Reputation Power: 0
Hi,

If you can specify more with which client code you want to embed it than it will be easy for us to give right solution.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > XML schema redesign

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap