File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Schema question..." Watch "Schema question..." New topic
Author

Schema question...

Sri Pos
Greenhorn

Joined: Dec 05, 2006
Posts: 9
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
Rahul Bhattacharjee
Ranch Hand

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


Rahul Bhattacharjee
LinkedIn - Blog
Sri Pos
Greenhorn

Joined: Dec 05, 2006
Posts: 9
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.
Manish Sarlashkar
Greenhorn

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: http://aspose.com/file-tools
 
subject: Schema question...