[snip]
>
> > Should the namespace used for the xsi:type always be a DC one?
> > Eg should I use
> > xsi:type=dcterms:LCSH and xsi:type=dcterms:W3CDTF
> > or should I use
> > xsi:type=loc:LCSH and xsi:type=w3c:W3CDTF
> > (assuming those namespaces exist).
>
> I would contend that scheme names in any namespace can be used in the
> xsi:type value, but that for the majority of DC metadata the names will be
> taken from the dcterms namespace.
>
[snip]
I agree with the above, but with some caveats:
To be conformant to XML Schema, values for the xsi:type attribute must
identify a type defined in an XML Schema which is derived from (extension or
restriction of) the type originally used to define the element. That type
can come from any namespace so long as the XML Schema for that namespace
imports the original type from the XML Schema where it is defined and then
derives the new type from the original type used for the given element.
Hopefully, an example will illustrate (based on the "Recommendations for XML
Schema for Qualified Dublin Core" at
http://www.ukoln.ac.uk/metadata/dcmi/xmlschema/):
Say you want a ZIP code encoding scheme for the dc:coverage element, such
that:
<dc:coverage xsi:type="USPS:ZIP">61820</dc:coverage>
where USPS refers to a custom namespace with its own XML Schema.
The USPS XML Schema would look similar to the following (only an untested
fragment):
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="usps_custom_namespace_uri"
targetNamespace="usps_custom_namespace_uri"
xmlns:dc="http://purl.org/dc/elements/1.1/"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<!--First, you need to import the XML schema which defines the base type
used for the coverage element:-->
<xs:import namespace="http://purl.org/dc/elements/1.1/"
schemaLocation="http://www.ukoln.ac.uk/metadata/dcmi/xmlschema/dc.xsd"/>
<!-- the location of this schema will change -->
<!--Next, you need to define your own ZIP type by restricting the base type
from the imported schema; in this case, dc:SimpleType.-->
<xs:complexType name="ZIP">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\d\d\d\d\d(-\d\d\d\d)*"/>
</xs:restriction>
</xs:simpleType>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
Now you can use the ZIP type for any element whose base type is the
dc:SimpleLiteral, which is all of the dc and dcterms elements defined in the
"Recommendations for XML Schema for Qualified Dublin Core".
Anyway, the bottom line is that by using xsi:type for DC encoding schemes,
the encodings are tied directly into the XML Schema, allowing the XML Schema
to tightly validate not only allowable values that can be used for the
xsi:type attribute, but also the values contained in the element itself.
(In the above, "\d\d\d\d\d(-\d\d\d\d)*" is a regular expression that will
restrict the USPS ZIP values to only legal ZIP code syntax.) With the
original proposal, using just the scheme attribute, none of this was
possible, at least not using XML Schema to validate.
Regards,
Tom
--
Thomas Habing
Research Programmer, Digital Library Projects
University of Illinois at Urbana-Champaign
155 Grainger Engineering Library Information Center, MC-274
[log in to unmask], (217) 244-4425
http://dli.grainger.uiuc.edu
|