[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: Sanity check please
  • From: David Nedrow <dnedrow@u...>
  • Date: Wed, 1 Mar 2006 17:30:11 -0500
  • Z-usanet-msgid: XID035kcawA30403X40

I'm working on a new schema and have managed to get much of what I  
need done, but I'm afraid that I'm doing some things incorrectly in  
an effort to get it working. Sort of like adding closing parens to  
LISP code until it works. ;)

Here's what I'm trying to accomplish....

A schema that references several other schemas in which are defined  
an number of types. Everything to be pulled together by a catalog file.

I've included a heavily truncated and simplified version of what I'm  
working with. My questions are as follows...

1). Have I created an operable catalog file
2). Have I correctly built the <schema/> headers for the subsequent  
files?
3). If 1 & 2 are correct, why must I import the schemas in order to  
use their defined elements? Shouldn't that be handled via my catalog  
file and the <schema/> declarations?

I'd appreciate any input (good or bad) as to what I've provided  
below. I have other questions, but their are predicated on the  
answers to my questions above. ;)

-David

catalog.xml
=========

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog
   PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN"
          "http://www.oasis-open.org/committees/entity/release/1.0/ 
catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"  
prefer="public">
     <public publicId="-//NEDRON//FOO Base Types V1.0//EN"  
uri="basetypes.xsd"/>
     <public publicId="-//NEDRON//FOO Data Types V1.0//EN"  
uri="datatypes.xsd"/>
     <public publicId="-//NEDRON//FOO Test V1.0//EN" uri="test.xsd"/>
</catalog>

basetypes.xsd
===========

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:ipbt="-//NEDRON//FOO Base Types V1.0//EN"
     elementFormDefault="qualified">
     <!--Declare a number of generic type equivalents-->
     <!-- string type -->
     <xs:complexType name="stringType" abstract="true">
         <xs:annotation>
             <xs:documentation>Character strings.</xs:documentation>
         </xs:annotation>
         <xs:simpleContent>
             <xs:extension base="xs:string"/>
         </xs:simpleContent>
     </xs:complexType>
</xs:schema>

datatypes.xsd
===========

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     targetNamespace="-//NEDRON//FOO Data Types V1.0//EN"
     xmlns:ipbt="-//NEDRON//FOO Base Types V1.0//EN"
     xmlns:ipdt="-//NEDRON//FOO Data Types V1.0//EN"
     elementFormDefault="qualified">
     <!--Generic descriptive text type -->
     <xs:import schemaLocation="ipbt.xsd"/>
     <xs:complexType name="descriptionType" abstract="true">
         <xs:annotation>
             <xs:documentation>This is a generic descriptive text
             entry.</xs:documentation>
         </xs:annotation>
         <xs:simpleContent>
             <xs:extension base="stringType"/>
         </xs:simpleContent>
     </xs:complexType>
</xs:schema>

test.xsd
======
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     targetNamespace="-//NEDRON//FOO Test V1.0//EN"
     xmlns:ipft="-//NEDRON//FOO Filter Types V1.0//EN"
     xmlns:ipdt="-//NEDRON//FOO Data Types V1.0//EN"
     elementFormDefault="qualified">
     <xs:import schemaLocation="basetypes.xsd"/>
     <xs:import schemaLocation="datatypes.xsd"/>
     <xs:element name="ruleset">
         <xs:complexType>
             <xs:sequence>
                 <xs:element name="rule" minOccurs="1"  
maxOccurs="unbounded">
                     <xs:complexType>
                         <xs:sequence>
                             <xs:element name="name"  
type="descriptionType"
                                 minOccurs="1" maxOccurs="1"/>
                             <xs:element name="desc"  
type="descriptionType"
                                 minOccurs="1" maxOccurs="1"/>
                             <xs:element name="vdesc"  
type="descriptionType"
                                 minOccurs="1" maxOccurs="1"/>
                         </xs:sequence>
                     </xs:complexType>
                 </xs:element>
             </xs:sequence>
         </xs:complexType>
     </xs:element>
</xs:schema>


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member