Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Schema(s): Help Needed

Status
Not open for further replies.

mlauzon

Technical User
Joined
May 27, 2004
Messages
1
Location
CA
I have the following schema, which I believe needs to be fleshed out more to make it more powerful, can someone please help and also point me in the right direction...hopefully once my project gets approved on SourceForge I will be adding this as well as something else I have to the project. Anyeverhow, here is the schema as it stands right now:



Code:
<?xml version="1.0" encoding="utf-8"?>


<xs:schema xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema">[/URL]


  <xs:element name="student">
  <xs:complexType>
  <xs:sequence>

    <xs:element name="stunum" type="xs:integer" />
    <xs:element name="lastname" type="xs:string" />
    <xs:element name="firstname" type="xs:string" />
    <xs:element name="age" type="xs:integer" />
    <xs:element name="dateborn" type="xs:date" />

  </xs:sequence>
  </xs:complexType>
  </xs:element>


  <xs:element name="address">
  <xs:complexType>
  <xs:sequence>

    <xs:element name="pnum" type="xs:integer" />
    <xs:element name="addnum" type="xs:integer" />
    <xs:element name="street" type="xs:string" />
    <xs:element name="city" type="xs:string" />
    <xs:element name="country" type="xs:string" />
    <xs:element name="poczip" type="xs:string" />

  </xs:sequence>
  </xs:complexType>
  </xs:element>


</xs:schema>


If you can make any changes to it, please do...any and all help would be very much appreciated.


Someone said the following to me as well, although I am having problems understanding what he is implying, probably because he didn't include an example:


In your case, it depends on where you're going with this, but I'd consider creating a ComplexType for a "person" and then define your "Student" as an extension of the Person type, adding perhaps the student ID. That way, if you added Instructor, you'd be able to re-use the generalized part of the definition of a person (since Instructors and Students both have some things in common).


If I can get this up and running, I will eventually need to be able to easily change some things in it to get it working with a second project that I have on SourceForge.





Michael Lauzon, Founder
The Quill Society
mlauzon@quillsociety.org
 
The only reason I can see to make something a complextype would be to get some reuse out of it. Unless you plan on having multiple student types, or multiple address types, this may be overkill.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top