File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Product and Other Certifications and the fly likes Schema question... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Schema question..." Watch "Schema question..." New topic

Schema question...

Sri Pos

Joined: Dec 05, 2006
Posts: 9
Hi all,

Here is the question:

I have a schema like this:


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?

Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
That doesn't look like a xml schema.

Rahul Bhattacharjee
LinkedIn - Blog
Sri Pos

Joined: Dec 05, 2006
Posts: 9
OK... here is the schema I was talking about...

<xs:schema targetNamespace="" xmlns:xs="" xmlns="" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Request">
<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:element name="RevenueDataRequestResponse">something</xs:element>

OK, now this is the schema... will you please answer? I really need it... Thanks,
Manish Sarlashkar

Joined: Apr 29, 2002
Posts: 8
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 agree. Here's the link:
subject: Schema question...
It's not a secret anymore!