Below is my first attempt at an XML schema for the ClassMaps of OPaL. It is
the equivalent of what I posted as a DTD a few days ago. At this point I'm
not sure about its validity (especially the namespace thing in the
preamble). I tried to validate it using IBM's VisualXML but ironically the
XML Schema is dependent on two DTD files one for Schema Structures and one
for Schema Datatypes of which the Structures DTD is dependant. I was able to
validate the Datatypes DTD but I get a "error loading document" message on
the XML Schema DTD. So if anyone wants to give a try to validate it I would
be forever grateful ; ).

For those of you who do not know what an XML Schema is, I will do my best to
summarize:

Basically XML Schema is a replacement for XML DTDs. The funny thing about is
that an XML Schema is validated by two XML DTDs which means, you can
correctly infer that an XML Schema file is its self an XML data file... got
that??? The purpose of the XML Schema it to define and constrain the content
of an XML data file which as I stated works much like an XML DTD. So...
what's the point? Well from what I know so far the benefit comes in its
ability to validate more data types other than character data. XML Schema
has a predefined set of "primitive datatypes" and a mechanism to allow the
developer to define custom "complex datatypes". If you want more information
you can read the two specs:

    http://www.w3.org/TR/xmlschema-1/
    http://www.w3.org/TR/xmlschema-2/

Here is the OPaL XMLSchema file for ClassMaps:

////////////////////////////////////////////////////////////////////////////
////////

<?xml version='1.0'?>
<!-- XML OPaL ClassMap Schema -->
<!DOCTYPE schema PUBLIC "-//APACHE//DTD OPLXMLSCHEMA 20000111//EN"
"OPaL.dtd" -->

<schema targetNS="http://www.YourDomain.org" version="0.1a"
        xmlns:cm="http://www.YourDomain.org/2000/ClassMapXMLSchema">

    <element name="ClassMaps">
        <element name="Class" type="cm:Class" minOccurs="1" maxOccurs="*"/>
    </element>

    <type name="ClassMap">
        <attribute name="Name" type="string"/>
        <attribute name="Proxy" type="boolean" default="false"/>
        <element name="AttributeMap" type="cm:AttributeMap" minOccurs="1"
maxOccurs="1"/>
    </type>

    <type name="AttributeMap">
        <attribute name="Name" type="string"/>
        <attribute name="PKey" type="boolean" default="false"/>
        <attribute name="Proxy" type="boolean" default="false"/>
        <element name="ColumnMap" type="cm:ColumnMap" minOccurs="1"
maxOccurs="1"/>
    </type>

    <type name="ColumnMap">
        <attribute name="Name" type="string"/>
        <element name="TableMap" type="cm:TableMap" minOccurs="1"
maxOccurs="1"/>
    </type>

    <type name="TableMap">
        <attribute name="Name" type="string"/>
    </type>

</schema>

////////////////////////////////////////////////////////////////////////////
////////


-ScottTavares-





------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to