[thelist] XSD (big request)

Christopher Joseph christopher at ideadesigners.com
Thu Jul 3 09:45:51 CDT 2003


Hi List,

[long message]

I am taking my first XSD / XML steps and I have tried to construct an 
XML Schema and a sample XML document to illustrate a series of clients, 
client's categories and their case studies. In the absence of any other 
XML orientated tech in the company I wondered if anyone out there felt 
charitable enough to comment on both the coding style, 
fit-for-purposeness, and syntax of the following.

Many thanks.

==============================================================

<!-- clientlist schema -->
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
	<xs:element name="clientList">	
		<xs:complexType>
			<xs:sequence>
			    <xs:element name="category">
			    	<xs:complexType>
			    	    <xs:sequence>
				    	    <xs:element name="client">
						    	<xs:complexType>
										<xs:sequence>
											<xs:element name="caseStudy" 
type="caseStudy"></xs:element>					    	
										</xs:sequence>
						    		<xs:attribute name="clientName" use="required" 
type="xs:string" />
						    	</xs:complexType>
						    </xs:element>
					    </xs:sequence>
					    <xs:attribute name="categoryName" type="xs:string" 
use="required" />
			    	</xs:complexType>
			  	</xs:element>
			</xs:sequence>  	
		</xs:complexType>
	</xs:element>
     <!-- type casting -->
	<xs:complexType name="caseStudy">
	    <xs:sequence>
			<xs:element name="location" type="xs:string"></xs:element>
			<xs:element name="product" type="xs:string"></xs:element>
			<xs:element name="synopsis" type="xs:string"></xs:element>
			<!-- available images for case study -->
			<xs:element name="images">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="caseImage">
							<xs:simpleType>
								<xs:restriction base="xs:string">
									<xs:pattern 
value="^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~])*$" 
/>
								</xs:restriction>
							</xs:simpleType>
						</xs:element>
					</xs:sequence>				
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="caseName" type="xs:string" />
	</xs:complexType>
</xs:schema>

============================================================================

<?xml version="1.0" encoding="UTF-8"?>
<clientList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="file:/C:/Program 
Files/eclipse/workspace/MyGeneralDevFolder/client.xsd">
     <category categoryName="Blue Chip">
         <client clientName="My First Company">
             <caseStudy caseName="Case Study One">
                 <location>Uk Wide</location>
                 <product>Generic Product X</product>
                 <synopsis>A paragraph or two of stuff in here - maybe 
even some XHTML?</synopsis>
                 <images>
 
<caseImage>http://www.mydomain.mytld/siteroot/images/imagea.gif</caseImage>
 
<caseImage>http://www.mydomain.mytld/siteroot/images/imageb.gif</caseImage>
                 </images>
             </caseStudy>
         </client>
         <client clientName="My Second Company">
         	<caseStudy caseName="Case Study Two">
         	    <location>London</location>
         	    <product>Specific Product Y</product>
         	    <synopsis>Some bullet points in XHTML and a 
paragraph</synopsis>
         	    <images>
         	 
<caseImage>http://www.mydomain.mytld/siteroot/images/image2.gif</caseImage>
 
<caseImage>http://www.mydomain.mytld/siteroot/images/image2.gif</caseImage>
 
<caseImage>http://www.mydomain.mytld/siteroot/images/image3.gif</caseImage>
         	    </images>
         	</caseStudy>
         </client>
     </category>
     <category categoryName="Multi National">
	    <client clientName="My Third Company">
	        <caseStudy caseName="Case Study Three">
	            <location>Aberdeen</location>
	            <product>Specific Product Y</product>
	            <synopsis>A bit of blah - some blah and a little more 
blah!</synopsis>
	            <images>
	 
<caseImage>http://www.mydomain.mytld/siteroot/images/imagelarge.gif</caseImage>
	            </images>
	        </caseStudy>
	    </client>
     </category>
</clientList>

=================================================================

-- 
Christopher Joseph

-------------------
[Internet]
http://www.ideadesigners.com  [iseries & web technologies]
mailto: christopher at ideadesigners.com

[Telephone]
mobile:   +44 7966 003860
Office:   +44 1494 731814 ext. 832
Direct:	  +44 1494 731832

[Instant Message]
ICQ: 78019724
YIM = Josephc_98
MSN = christopher at ideadesigners.com



More information about the thelist mailing list