My first XSD... please help
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 2
- Joined: Tue Aug 28, 2007 3:32 pm
My first XSD... please help
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
-
- Posts: 2
- Joined: Tue Aug 28, 2007 3:32 pm
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???
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???
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service