This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Schema question...

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

Here is the question:

I have a schema like this:

<request>
<first_name/>
<last_name/>
<ssn/>
</request>

In the above request, is it possible to make ssn or the combination of first_name and last_name required elements? In other word, the client can send in ssn or [first_name AND last_name].

Is it possible? If so how should the schema look like?

Thanks,
Sri
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That doesn't look like a xml schema.
 
Sri Pos
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK... here is the schema I was talking about...

<xs:schema targetNamespace="something.someone.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="xmlbeans.something.someone.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Request">
<xs:complexType>
<xs:sequence>
<xs:element name="first_name" type="xs:string"/>
<xs:element name="las_name" type="xs:string" minOccurs="0"/>
<xs:element name="ssn" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RevenueDataRequestResponse">something</xs:element>


OK, now this is the schema... will you please answer? I really need it... Thanks,
Sri.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Define a new typed complexType , let's say 'full_name', which includes'first_name' and last_name and add the element 'full_name' to the Request type/element along with 'ssn' but now use 'xsd:choice' instead of 'xsd:sequence'. This will allow either 'full_name' or 'ssn'. But this will add one new element 'full_name' to encapsulate 'first_name' and 'last_name'.
 
I can't take it! You are too smart for me! Here is the tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic