This should do it for ya ...
---------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Contracts">
<xs:complexType>
<xs:sequence>
<xs:element name="Glossary" type="GlossaryType"/>
<xs:element name="Sections" type="SectionsType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="SectionsType">
<xs:sequence>
<xs:element name="Section" type="SectionType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="GlossaryType">
<xs:sequence>
<xs:element name="Term" type="TermType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TermType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="ID" type="xs:unsignedInt" use="required"/>
<xs:attribute name="Word" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="SectionType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="ID" type="xs:unsignedInt" use="required"/>
<xs:attribute name="Title" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
---------------------------------------------------------------------------------------------------------------------------------------------
Jeremy Shovan
"Andy B" <a_borka@sbcglobal.netwrote in message
news:#mcnxHStIHA.1316@TK2MSFTNGP06.phx.gbl...
Quote:
I have to write an xml schema but don't remember exactly how to do that. I
tried using a bunch of different kinds of schema designers but something
doesn't seem right. One of them told me the following code was invalid:
>
<xs:element name ="Contract">
<xs:ComplexType>
</xs:ComplexType>
</xs:element>
>
it said that "name was an invalid attribute and doesn't belong here". This
is what I have to do:
>
1. The root element of the xml file needs to be called "Contract".
2. In the root node there will be different child nodes like "Sections",
"Glossary" and so on.
>
These are the main steps I forgot how to do. An example of what I need to
help me out is this (in xml format):
>
<Contracts>
<Glossary>
<Term ID="1" Word = "Contract">
The document you are reading.
</Term>
<Term ID="2" Word = "Host">
The person that pays the price of the contract.
</Term>
....
</Glossary>
<Sections>
<Section ID = "1" Title = "Section 1 title here">
The text for section 1
</Section>
<Section ID = "2" Title = "Section 2 title goes here.">
Section 2 text.
</Section>
...
</Sections></Contract>
>
Any idea how to create this in xml schema format?
>
>
>
|