aspose file tools
The moose likes XML and Related Technologies and the fly likes Help in creating XML Schema Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Help in creating XML Schema " Watch "Help in creating XML Schema " New topic
Author

Help in creating XML Schema

Saran Vel
Ranch Hand

Joined: Nov 03, 2000
Posts: 111
Hi,
Please help me to write a XML Schema reflecting the following java class structure.
Class Response has a collection of Contact objects.
Class Contact has type and group as its attributes.
Class Phone and Class Email are subclasses of Contact.
Following is a sample XML for the same.


I found difficulty in reflecting the inheritance in the above Java structure, in Schema.
Any help would be highly appreciated.
Thanks


Saran
Sun Certified Java2 Programmer
aravind yarram
Greenhorn

Joined: Mar 28, 2003
Posts: 12
<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema" elementFormDefault = "qualified">
<xsd:element name = "Response">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Contact" maxOccurs="unbounded" type="ContactType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="ContactType">
<xsd:sequence>
<xsd:element name = "Phone" maxOccurs = "1">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base = "xsd:string">
<xsd:attribute name = "group" use="required" type="xsd:integer"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name = "Email" maxOccurs = "1">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base = "xsd:string">
<xsd:attribute name = "group" use="required" type="xsd:integer"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>


SCJP2<br />BEA Certified J2EE Developer
aravind yarram
Greenhorn

Joined: Mar 28, 2003
Posts: 12
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Help in creating XML Schema
 
Similar Threads
Implicit objects in jspInit() method
Using BizTalk Schema for cXML
jibx binding Error: Nonstatic field name not found in
XMl to flatfile conversion
EJBQL Exercise