XMLSpy编辑XSD,DTD,XML和XSLT文件非常方便,altova公司还提供了Home Edition免费版提供下载。
首先定义一个描述Component的XML Schema文件
<?xml version="1.0" encoding="UTF-8" ?>
<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by ibm (ibm) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:col="http://www.novacolimas.com/colimas/namespace"
targetNamespace="http://www.novacolimas.com/colimas/namespace" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="ComponentsBasicInfo">
<xs:annotation>
<xs:documentation>Title: cbi.xsd
Subject: the component basic information.
Publisher: Nova Corporation, Colimas.
Format: text/xml
Creator: Zhao Lei
Date.Created: 2005-04-23
Language: en-US
Description:
Change Log:
Version Date Modifier Description
01.00 2005/04/25 Zhao Lei Initial release.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="ComponentBasicInfo" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="SerialNo">
<xs:annotation>
<xs:documentation>Component SerialNo, 27 characters with a-z or A-Z or 0-9</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9]{27}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Name" type="xs:string">
<xs:annotation>
<xs:documentation>Component Name</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Alias" type="xs:string">
<xs:annotation>
<xs:documentation>Component Alias</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Version" default="1.0">
<xs:annotation>
<xs:documentation>Component Version</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="DevelopmentLanguage" type="xs:string">
<xs:annotation>
<xs:documentation>Component Development Language</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="DevelopmentPlatform" type="xs:string" />
<xs:element name="Authors" type="xs:string" />
<xs:element name="Status" default="Unconfirmed">
<xs:annotation>