• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

union of two complex types - how would i do this?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have been scratching my head with this problem for a while now and I thought I would ask for some help.

Suppose I have a home-address tag specified as such in my XML:

<home-address>
<line1>123 smith street</line1>
<line2/>
<city>miami</city>
<state>FL</state>
<zip>33489</zip>
<country>USA</country>
</home-address>

and suppose that somewhere else I want to default to this address for other address specifications such as ...

<credit-card-billing-address use-default="true"/>
or
<ship-to-address use-default="true"/>

or to specify a override address ...

<credit-card-billing-address>
<line1>123 smith street</line1>
<line2/>
<city>miami</city>
<state>FL</state>
<zip>33489</zip>
<country>USA</country>
</credit-card-billing-address>

how do i write the XML schema such that both content models work. I would hate to have to re-specifiy the same address for both <credit-card-billing-address> and <ship-to-address> if they exactly the same as the <home-address>.

Here is what I have so far:



So I would like either the content model to be either requiredAddressType which fleshes out the address or alternateAddressType which defaults to an already specified requiredAddress.

Many thanks,
Joe
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes... try this:

reply
    Bookmark Topic Watch Topic
  • New Topic