My first XSD... please help
Posted: Tue Aug 28, 2007 3:46 pm
Hi everybody,
I have a xml-document dat looks like this:
<?xml version="1.0"?>
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XsdCatalog.xsd">
<cd>
<title>AAA</title>
<artist>BBB</artist>
<country>CCC</country>
<company>DDD</company>
<price>10.50</price>
<year>1999</year>
</cd>
.........
</catalog>
the xsd file looks like the following:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CATALOG">
<xs:complexType>
<xs:sequence>
<xs:element name="CD" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="TITLE" type="xs:string"/>
<xs:element name="ARTIST" type="xs:string"/>
<xs:element name="COUNTRY" type="xs:string"/>
<xs:element name="COMPANY" type="xs:string"/>
<xs:element name="PRICE">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minExclusive value="0"/>
<xs:fractionDigits value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="YEAR"/>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="[1-9]{4}"/>
</xs:restriction>
</xs:simpleType>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Nou if I try to bouwse the xml file using explorer, I'm supposed to get an error because
as you kan see I used tag names in lowercase in the xml doc (titel) but in de xsd I've used uppercases...maybe I'm wrong but can you please tel me wat I'm doing wrong?
thanx
I have a xml-document dat looks like this:
<?xml version="1.0"?>
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XsdCatalog.xsd">
<cd>
<title>AAA</title>
<artist>BBB</artist>
<country>CCC</country>
<company>DDD</company>
<price>10.50</price>
<year>1999</year>
</cd>
.........
</catalog>
the xsd file looks like the following:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CATALOG">
<xs:complexType>
<xs:sequence>
<xs:element name="CD" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="TITLE" type="xs:string"/>
<xs:element name="ARTIST" type="xs:string"/>
<xs:element name="COUNTRY" type="xs:string"/>
<xs:element name="COMPANY" type="xs:string"/>
<xs:element name="PRICE">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minExclusive value="0"/>
<xs:fractionDigits value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="YEAR"/>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="[1-9]{4}"/>
</xs:restriction>
</xs:simpleType>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Nou if I try to bouwse the xml file using explorer, I'm supposed to get an error because
as you kan see I used tag names in lowercase in the xml doc (titel) but in de xsd I've used uppercases...maybe I'm wrong but can you please tel me wat I'm doing wrong?
thanx