Page 1 of 1

My first XSD... please help

Posted: Tue Aug 28, 2007 3:46 pm
by abdelhak
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

Posted: Tue Aug 28, 2007 5:17 pm
by jkmyoung
You've already named your problem: case

Either change your schema to use lowercase or change your source to use upper case.

Posted: Wed Aug 29, 2007 9:30 am
by abdelhak
Hi,
The reason why I used lowercase in de xml document is to test whether the schema (XSD) is a valid one. if het is, I should get an ERROR when brouwsing de xml-doc, because het is then illegal to use voor example an element 'title' or 'artist' in de xml document instead you have toe use 'TITLE' and 'ARTIST'. wat doe you think???