> DCXMLRevision/DCXMLSchema/2006-05-29

You are not allowed to delete this page.

Clear message

DC-XML and W3C XML Schema

This document is part of the [Self]DC Architecture Wiki.

IMPORTANT: Do not cite materials in this Wiki other than for the purposes of collaborating on document creation. This Wiki is intended to be used to work on draft copies of documents. Finished documents will be published, in a persistent and citable form, on the dublincore.org Web site (or elsewhere in some cases).

This is a draft document, made available for public comment.

Comments should be sent to the DC-ARCHITECTURE@jiscmail.ac.uk mailing list (for detailed technical comments) or to the DC-GENERAL@jiscmail.ac.uk mailing list (for comments of a more general nature).

Title: DC-XML and W3C XML Schema
Creator: Pete Johnston, Eduserv Foundation <pete.johnston@eduserv.org.uk>
Creator: Andy Powell, Eduserv Foundation <andy.powell@eduserv.org.uk>
Date Issued: 2006-05-29
Identifier: http://dublincore.org/architecturewiki/DCXMLRevision/DCXMLSchema/2006-05-29
Replaces: Not applicable
Is Replaced By: Not applicable
Latest Version: http://dublincore.org/architecturewiki/DCXMLRevision/DCXMLSchema
Description of Document: This document discusses how W3C XML Schema may be used to describe the DC-XML XML format.

Contents

  1. Introduction

  2. DC-XML and W3C XML Schema

  3. Constraining DC-XML using W3C XML Schema

  4. Notes

  5. References

1. Introduction

The DCMI Abstract Model [DCAM] describes the constructs that make up a DC metadata description set. DC-XML is an XML format for representing a DC metadata description set in XML [DCXML] (See Note 1)

This document outlines briefly how the DC-XML format is described using W3C XML Schema in the set of schemas provided by DCMI. It then provides some examples of how these schemas may be used in conjunction with other schemas defined by other parties to implement some of the constraints on a DC description set which are typically specified by a DC Application Profile.

Note: This document references various XML schemas and XML instances. These are presently made available as attachments to pages in this Wiki. This is a temporary measure, and, when stable, they will be assigned persistent URIs on the DCMI Web site.

2. DC-XML and W3C XML Schema

The DC-XML format is not dependent on any features of W3C XML Schema, but can be described using W3C XML Schema.

DCMI provides the following set of schemas to describe the DC-XML format;

2.1 Schema: dcx.xsd Target XML Namespace: http://purl.org/dc/xml/

This schema declares the XML elements and attributes associated with names in the http://purl.org/dc/xml/ XML Namespace. It also defines a set of XML Schema complex types which describe the default content models for these elements.

2.1.1 The dcx:DescriptionSetElement complex type

The dcx:DescriptionSetElement complex type defines the content model for a DC-XML Description Set Element. A DC-XML Description Set Element may contain one or more DC-XML Description Elements; the names of those Description Elements may be from any XML Namespace. A DC-XML Description Set Element may also have XML attributes, the names of which may be from any XML Namespace other than http://purl.org/dc/xml/.

   <xs:complexType name="DescriptionSetElement">
     <xs:sequence>
       <xs:any namespace="##any" minOccurs="1" maxOccurs="unbounded" processContents="lax" />
     </xs:sequence>
     <xs:attributeGroup ref="DescriptionSetElementAttributes" />
   </xs:complexType>

   <xs:attributeGroup name="DescriptionSetElementAttributes">
     <xs:anyAttribute namespace="##other" processContents="lax" />
   </xs:attributeGroup>

   <xs:element name="descriptionSet" type="DescriptionSetElement" />

XSD Example 1: The dcx:DescriptionSetElement complexType

2.1.2 The dcx:DescriptionElement complex type

The dcx:DescriptionElement complex type defines the content model for a DC-XML Description Element. A DC-XML Description Element may contain one or more DC-XML Statement Elements; the names of those Statement Elements may be from any XML Namespace other than http://purl.org/dc/xml/. A DC-XML Description Element may also have a dcx:resourceURI and a dcx:descriptionId attribute. A DC-XML Description Element may also have other XML attributes, the names of which may be from any XML Namespace other than http://purl.org/dc/xml/.

   <xs:complexType name="DescriptionElement">
     <xs:sequence>
       <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
     </xs:sequence>
     <xs:attributeGroup ref="DescriptionElementAttributes" />
   </xs:complexType>

   <xs:attributeGroup name="DescriptionElementAttributes">
     <xs:attribute ref="descriptionId" use="optional"/>
     <xs:attribute ref="resourceURI" use="optional"/>
     <xs:anyAttribute namespace="##any" processContents="lax" />
   </xs:attributeGroup>

   <xs:attribute name="descriptionId" type="xs:ID" />
   <xs:attribute name="resourceURI" type="xs:anyURI" />

   <xs:element name="description" type="DescriptionElement" /> 

XSD Example 2: The dcx:DescriptionElement complexType

2.1.3 The dcx:StatementElement complex type

The dcx:StatementElement complex type defines the content model for a DC-XML Statement Element. A DC-XML Statement Element may contain Value Representation Elements, which must have the names indicated. A DC-XML Statement Element may also have a dcx:valueURI, dcx:vocabEncSchemeURI or dcx:descriptionRef attribute. A DC-XML Statement Element may also have other XML attributes, the names of which may be from any XML Namespace other than http://purl.org/dc/xml/.

   <xs:complexType name="StatementElement">
     <xs:sequence>
       <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element ref="valueString"/>
         <xs:element ref="XMLRepresentation"/>
         <xs:element ref="binaryRepresentation"/>
       </xs:choice>
     </xs:sequence>
     <xs:attributeGroup ref="StatementElementAttributes"/>
   </xs:complexType>

   <xs:attributeGroup name="StatementElementAttributes">
     <xs:attribute ref="valueURI" use="optional"/>
     <xs:attribute ref="vocabEncSchemeURI" use="optional"/>
     <xs:attribute ref="vocabEncSchemeQName" use="optional"/>
     <xs:attribute ref="descriptionRef" use="optional"/>
     <xs:anyAttribute namespace="##other" processContents="lax" />
   </xs:attributeGroup>

   <xs:attribute name="valueURI" type="xs:anyURI" />
   <xs:attribute name="vocabEncSchemeURI" type="xs:anyURI" />
   <xs:attribute name="vocabEncSchemeQName" type="xs:QName" />
   <xs:attribute name="descriptionRef" type="xs:IDREF" /> 

XSD Example 3: The dcx:StatementElement complexType

2.1.4 The dcx:ValueStringElement complex type

The dcx:ValueStringElement complex type defines the content model for a DC-XML Value String Element. A DC-XML Value String Element must have simple content. A DC-XML Statement Element may also have a xml:lang, dcx:syntaxEncSchemeURI or dcx:syntaxEncSchemeQName attribute. A DC-XML Statement Element may also have other XML attributes, the names of which may be from any XML Namespace other than http://purl.org/dc/xml/.

   <xs:complexType name="ValueStringElement">
     <xs:simpleContent>
       <xs:extension base="xs:anySimpleType">
        <xs:attributeGroup ref="ValueStringElementAttributes"/>
       </xs:extension>
     </xs:simpleContent>
   </xs:complexType>

   <xs:attributeGroup name="ValueStringElementAttributes">
     <xs:attribute ref="xml:lang" use="optional"/>
     <xs:attribute ref="syntaxEncSchemeURI" use="optional"/>
     <xs:attribute ref="syntaxEncSchemeQName" use="optional"/>
     <xs:anyAttribute namespace="##other" processContents="lax" />
   </xs:attributeGroup>

   <xs:attribute name="syntaxEncSchemeURI" type="xs:anyURI" />
   <xs:attribute name="syntaxEncSchemeQName" type="xs:QName" />

   <xs:element name="valueString" type="ValueStringElement" /> 

XSD Example 4: The dcx:ValueStringElement complexType

2.1.5 The dcx:XMLRepresentationElement complex type

The dcx:XMLRepresentationElement complex type defines the content model for a DC-XML XML Representation Element. A DC-XML XML Representation Element may have mixed content. A DC-XML XML Representation Element may have a dcx:representationURI attribute. A DC-XML XML Representation Element may also have other XML attributes, the names of which may be from any XML Namespace other than http://purl.org/dc/xml/.

   <xs:complexType name="XMLRepresentationElement" mixed="true">
     <xs:sequence>
       <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
     </xs:sequence>
     <xs:attributeGroup ref="XMLRepresentationElementAttributes"/>
   </xs:complexType>

   <xs:attributeGroup name="XMLRepresentationElementAttributes">
     <xs:attribute ref="representationURI" use="optional" />
     <xs:anyAttribute namespace="##other" processContents="lax" />
   </xs:attributeGroup>

   <xs:attribute name="representationURI" type="xs:anyURI" />

   <xs:element name="XMLRepresentation" type="XMLRepresentationElement" />

XSD Example 5: The dcx:XMLRepresentationElement complexType

2.1.6 The dcx:BinaryRepresentationElement complex type

The dcx:BinaryRepresentationElement complex type defines the content model for a DC-XML Binary Representation Element. A DC-XML Binary Representation Element must have simple content. A DC-XML Binary Representation Element may have a dcx:representationURI attribute. A DC-XML Binary Representation Element may also have other XML attributes, the names of which may be from any XML Namespace other than http://purl.org/dc/xml/.

   <xs:complexType name="BinaryRepresentationElement">
     <xs:simpleContent>
       <xs:extension base="xs:base64Binary">
        <xs:attributeGroup ref="BinaryRepresentationElementAttributes"/>
       </xs:extension>
     </xs:simpleContent>
   </xs:complexType>

   <xs:attributeGroup name="BinaryRepresentationElementAttributes">
     <xs:attribute ref="representationURI" use="optional" />
     <xs:anyAttribute namespace="##other" processContents="lax" />
   </xs:attributeGroup>

   <xs:element name="binaryRepresentation" type="BinaryRepresentationElement" />

XSD Example 6: The dcx:BinaryRepresentationElement complexType

2.2 Schema: dc.xsd Target XML Namespace: http://purl.org/dc/elements/1.1/

This schema declares a set of Statement Elements to represent statements referring to the 15 properties of the DCMES, i.e. these declarations use the complex type dcx:StatementElement.

It also defines a complex type dc:DescriptionElement as a convenience for schema authors who need to define a Description Element allowing all of the Statement Elements in the http://purl.org/dc/elements/1.1/ XML Namespace as child elements.

2.3 Schema: dcterms.xsd Target XML Namespace: http://purl.org/dc/terms/

This schema declares a set of Statement Elements to represent statements referring to the properties of the DC Terms vocabulary., i.e. these declarations use the complex type dcx:StatementElement.

It also defines a complex type dcterms:DescriptionElement as a convenience for schema authors who need to define a Description Element for all of the Statement Elements in the http://purl.org/dc/terms/ XML Namespace.

2.4 Schema: dcmitype.xsd Target XML Namespace: http://purl.org/dc/dcmitype/

This schema defines only a set of named XML Schema simple types which specify an enumerated lists of strings, URIs and XML QNames for referring to the classes of the DCMI Type Vocabulary.

3. Constraining DC-XML using W3C XML Schema

A Dublin Core Application Profile (DCAP) specifies the terms that are used in a class of DC description sets.

In the context of an application, it may be desirable to constrain the content of a DC-XML instance so that it supports the representation of only certain metadata terms (e.g. the set of properties and classes specified by a DC Application Profile), or so that the use of certain constructs from the DCMI Abstract Model are required (e.g. for a specified property, statements always use a value string, or for another property, statements use a value URI), and for a validator to check that these constraints are met by the instance.

The content models for the principal XML elements within a DC-XML instance are defined by the XML Schema complex types listed in section 2. XML Schema provides a mechanism known as type derivation by which new XML Schema datatypes can be defined, based on existing types, to specify new content models. In particular this document focuses on the derivation of complex types by restriction:

Once a new derived complex type has been defined, it must be associated with the XML element to which it is being applied. There are two mechanisms for achieving this:

Examples of both approaches are described below.

Whichever of the two approaches is taken, it is important to note that the use of these derived complex types does not change the interpretation of a DC-XML instance document in the sense of how the components within the XML document are mapped to the constructs used within the DCMI Abstract Model: the use of derived complex types enables more restrictive checking of an instance by a processor performing XML Schema validation, but does not add to the DC metadata description set.

3.1 Constraining the Descriptions within a Description Set

The DC-XML syntax requires the use of the dcx:descriptionSet XML element to represent a description set. Each child element of the dcx:descriptionSet XML element represents a description. The default content model for the dcx:DescriptionSet XML element permits these child elements, the Description Elements, to have any name. An application might specify a content model requiring those Description Elements to be of elements of specific names (and then provide a restricted content model for those elements. See section section 3.2.)

Using W3C XML Schema, this might be done by deriving a named XML Schema complex type that restricts the default content model for the dcx:descriptionSet XML element and referencing this derived type using the xsi:type attribute.

3.1.1 Deriving a complex type by restriction

The definition of the !FooBarDescriptionSet complex type below specfies that the Description Elements (the child elements of the Description Set Element) must have the names your:fooDescription and your:barDescription, and that there must be at least one occurrence of each.

   <xs:complexType name="FooBarDescriptionSet">
     <xs:complexContent>
       <xs:restriction base="dcx:DescriptionSetElement">
         <xs:sequence>
           <xs:element ref="fooDescription" minOccurs="1" maxOccurs="unbounded" />
           <xs:element ref="barDescription" minOccurs="1" maxOccurs="unbounded" />
         </xs:sequence>
         <xs:attributeGroup ref="dcx:DescriptionSetElementAttributes" />
       </xs:restriction>
     </xs:complexContent>
   </xs:complexType>

XSD Example 7: Deriving a restricted complex type for the Description Set Element

An XML instance references this new complex type using the xsi:type attribute:

<?xml version="1.0" encoding="UTF-8"?>

<dcx:descriptionSet
          xsi:type="dcap:FooBarDescriptionSet"
          xmlns:dc="http://purl.org/dc/elements/1.1/"
          xmlns:dcterms="http://purl.org/dc/terms/"
          xmlns:dcx="http://purl.org/dc/xml/"
          xmlns:dcap="http://example.org/your/dc/xml/yourap/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://example.org/your/dc/xml/yourap/ ../xmls/yourdcap.xsd" 
>

   <dcap:fooDescription dcx:resourceURI="http://example.org/foo/1">
   
   </dcap:fooDescription>

   <dcap:barDescription dcx:resourceURI="http://example.org/bar/1">
   
   </dcap:barDescription>

</dcx:descriptionSet>

XML Example 1: Referencing the derived complex type for the Description Set Element

The xsi:type approach is taken for this case because the DC-XML format requires that the Description Set Element has the name dcx:descriptionSet, and a declaration for this element is provided in the DCMI-supplied dc.xsd schema. It is possible to use the xsd:redefine mechanism to modify the definition of the dcx:DescriptionSetElement complex type. However, that modified definition would then apply to all other schema components that reference that type: it would not be possible, for example, to reference the original definition of the dcx:DescriptionSetElement complex type in another declaration. Also the use of the xsd:redefine mechanism can make it difficult for a human reader of the schemas to interpret which version of the type definition is in force: looking at the base schema, a reader has no indication where that the type has been redefined in another schema.

3.1.2 Example Schemas and Instances

The schema simpledc.xsd example schema defines a complex type which restricts the content of the Description Set Element to a single Description Element with the name dcx:description. The instance ex1.xml validates against the simpledc.xsd schema.

The schema qualifieddc.xsd example schema defines a complex type which requires that the content of the Description Set Element is at least one Description Element with the name dcx:description. The instance ex2.xml validates against the qualifieddc.xsd schema.

The schema mydcap.xsd example schema defines a complex type which requires that the content of the Description Set Element is at least one Description Element with the name dcx:description. The instances ex3.xml, ex4.xml and ex5.xml validate against the mydcap.xsd schema.

The schema yourdcap.xsd example schema defines a complex type which requires that the content of the Description Set Element is at least one Description Element with the name dcap:fooDescription followed by at least one Description Element with the name dcap:barDescription (where the prefix dcap is associated with a non-DCMI owned XML Namespace Name). The instance ex6.xml validates against the yourdcap.xsd schema.

3.2 Constraining the Statements used in a Description

Each child element of the dcx:DescriptionSet XML element represents a description, and is referred to as a Description Element. Each child element of those Description Elements represents a statement, and is referred to as a Statement Element. An application might specify that statements within a class of descriptions refer only to specified properties. In DC-XML this can be achieved by specifying a content model for a Description Element that requires the Statement Elements to be of elements with specific names.

Either of the approaches described at the start of section 3 might be applied in this case.

3.2.1 Deriving a complex type by restriction

One approach would be to derive a named XML Schema complex type that restricts the default type for the dcx:description XML element, and to reference this derived type in the XML instance using the xsi:type attribute.

The definition of the !FooDescription complex type definition below specfies that the Statement Elements (the child elements of the Description Element) must have the names dc:title, dc:type, dc:subject or dcterms:isReferencedBy.

   <xs:complexType name="FooDescription">
     <xs:complexContent>
       <xs:restriction base="dcx:DescriptionElement">
         <xs:sequence>
           <xs:group ref="fooStatementElementsGroup"/>
         </xs:sequence>
         <xs:attributeGroup ref="dcx:DescriptionElementAttributes" />
       </xs:restriction>
     </xs:complexContent>
   </xs:complexType>

  <xs:group name="fooStatementElementsGroup">
     <xs:sequence>
       <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element ref="dc:title" />
         <xs:element ref="dc:type" />
         <xs:element ref="dc:subject" />
         <xs:element ref="dcterms:isReferencedBy" />
       </xs:choice>
     </xs:sequence>
   </xs:group>

XSD Example 8: Deriving a restricted complex type for the Description Element

<?xml version="1.0" encoding="UTF-8"?>
<dcx:descriptionSet
          xsi:type="dcap:FooBarDescriptionSet"
          xmlns:dc="http://purl.org/dc/elements/1.1/"
          xmlns:dcterms="http://purl.org/dc/terms/"
          xmlns:dcx="http://purl.org/dc/xml/"
          xmlns:dcap="http://example.org/your/dc/xml/yourap/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://example.org/your/dc/xml/yourap/ ../xmls/yourdcap.xsd" 
>

   <dcx:description xsi:type="dcap:FooDescription" 
                    dcx:resourceURI="http://example.org/foo/1">
     <dc:title>
       <dcx:valueString xml:lang="en-GB">First foo</dcx:valueString>
     </dc:title>
     <dc:subject dcx:vocabEncSchemeURI="http://purl.org/dc/terms/LCSH">
       <dcx:valueString>Horse-drawn vehicles -- Queensland -- Atherton</dcx:valueString>
     </dc:subject>
     <dc:type dcx:vocabEncSchemeURI="http://purl.org/dc/terms/DCMIType"
              dcx:valueURI="http://purl.org/dc/dcmitype/Image">
       <dcx:valueString>Image</dcx:valueString>
     </dc:type>
     <dcterms:isReferencedBy dcx:valueURI="http://example.org/bar/1" />
     <dcterms:isReferencedBy dcx:valueURI="http://example.org/bar/2" />
   </dcap:fooDescription>

   <dcx:description xsi:type="dcap:BarDescription"
                    dcx:resourceURI="http://example.org/bar/1">

   </dcx:description> 

</dcx:descriptionSet>

XML Example 2: Referencing the derived complex type for the Description Element

3.2.2 Declaring a new Description Element

Since the DC-XML format permits Description Elements to have any name, an application might declare elements with its own names for Description Elements and provide content models for those elements, using a complex type derived by restriction from the dcx:DescriptionElement complex type.

The element declaration below declares the your:fooDescription Description Element. The content model limits the Statement Elements which can occur within this Description Element to those with the names dc:title, dc:type, dc:subject or dcterms;isReferencedBy. The example uses a named complex type but it could also have used an anonymous complex type since the type is not referenced anywhere else in the schema or in the XML instance

   <xs:complexType name="FooDescription">
     <xs:complexContent>
       <xs:restriction base="dcx:DescriptionElement">
         <xs:sequence>
           <xs:group ref="fooStatementElementsGroup"/>
         </xs:sequence>
         <xs:attributeGroup ref="dcx:DescriptionElementAttributes" />
       </xs:restriction>
     </xs:complexContent>
   </xs:complexType>

  <xs:group name="fooStatementElementsGroup">
     <xs:sequence>
       <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="dc:title" />
        <xs:element ref="dc:type" />
        <xs:element ref="dc:subject" />
        <xs:element ref="dcterms:isReferencedBy" />
       </xs:choice>
     </xs:sequence>
   </xs:group>

   <xs:element name="fooDescription" type="FooDescription" />

XSD Example 9: Declaring a new Description Element

<?xml version="1.0" encoding="UTF-8"?> 
<dcx:descriptionSet
          xsi:type="dcap:FooBarDescriptionSet"
          xmlns:dc="http://purl.org/dc/elements/1.1/"
          xmlns:dcterms="http://purl.org/dc/terms/"
          xmlns:dcx="http://purl.org/dc/xml/"
          xmlns:dcap="http://example.org/your/dc/xml/yourap/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://example.org/your/dc/xml/yourap/ ../xmls/yourdcap.xsd" 
>

   <dcap:fooDescription dcx:resourceURI="http://example.org/foo/1">
     <dc:title>
       <dcx:valueString xml:lang="en-GB">First foo</dcx:valueString>
     </dc:title>
     <dc:subject dcx:vocabEncSchemeURI="http://purl.org/dc/terms/LCSH">
       <dcx:valueString>Horse-drawn vehicles -- Queensland -- Atherton</dcx:valueString>
     </dc:subject>
     <dc:type dcx:vocabEncSchemeURI="http://purl.org/dc/terms/DCMIType"
              dcx:valueURI="http://purl.org/dc/dcmitype/Image">
       <dcx:valueString>Image</dcx:valueString>
     </dc:type>
     <dcterms:isReferencedBy dcx:valueURI="http://example.org/bar/1" />
     <dcterms:isReferencedBy dcx:valueURI="http://example.org/bar/2" />
   </dcap:fooDescription>

   <dcap:barDescription dcx:resourceURI="http://example.org/bar/1">
   
   </dcap:barDescription> 

</dcx:descriptionSet>

XML Example 3: Using a new Description Element

3.2.3 Example Schemas and Instances

The schema simpledc.xsd example schema defines a complex type which restricts the content of the Description Element to a set of Statement Elements with names corresponding to the URIs of the 15 properties of the DCMES. The instance ex1.xml validates against the simpledc.xsd schema.

The schema qualifieddc.xsd example schema defines a complex type which restricts the content of the Description Elements to a set of Statement Elements with names corresponding to the URIs of the properties defined by DCMI. The instance ex2.xml validates against the qualifieddc.xsd schema.

The schema mydcap.xsd example schema defines complex types which restricts the content of the Description Elements to Statement Elements with names corresponding to specified lists of properties. The instances ex3.xml, ex4.xml and ex5.xml validate against the mydcap.xsd schema.

The schema yourdcap.xsd example schema defines complex types which restrict the content of the Description Elements to Statement Elements with names corresponding to specified lists of properties. It also declares the dcap:fooDescription Description Element and the dcap:barDescription Description Element using those complex types. The instance ex6.xml validates against the yourdcap.xsd schema.

3.3 Constraining the Constructs used in a Statement

An application might specify that for a statement referencing a specified property, there are limitations on the other DCAM constructs that can be used in that statement. In DC-XML this can be achieved by specifying a content model for a Statement Element.

The name of the Statement Element is determined by the property URI, so this is typically done by derive a named XML Schema complex type that restricts the default type for the Statement Element, and referencing this derived type in the XML instance using the xsi:type attribute.

3.3.1 Deriving a complex type by restriction

The definition of the FooIsRefByStatement complex type definition below specifies that the Statement Element must provide a dcx:valueURI attribute, and must be empty.

   <xs:complexType name="FooIsRefByStatement">
     <xs:complexContent>
       <xs:restriction base="dcx:StatementElement">
         <xs:sequence />
         <xs:attribute ref="dcx:valueURI" use="required" />
       </xs:restriction>
     </xs:complexContent>
   </xs:complexType>

XSD Example 10: Deriving a restricted complex type for a Statement Element

<?xml version="1.0" encoding="UTF-8"?> 
<dcx:descriptionSet
          xsi:type="dcap:FooBarDescriptionSet"
          xmlns:dc="http://purl.org/dc/elements/1.1/"
          xmlns:dcterms="http://purl.org/dc/terms/"
          xmlns:dcx="http://purl.org/dc/xml/"
          xmlns:dcap="http://example.org/their/dc/xml/theirrap/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://example.org/their/dc/xml/theirap/ ../xmls/theirdcap.xsd" 
>

   <dcx:description xsi:type="dcap:FooDescription" 
                    dcx:resourceURI="http://example.org/foo/1">
     <dc:title>
       <dcx:valueString xml:lang="en-GB">First foo</dcx:valueString>
     </dc:title>
     <dc:subject dcx:vocabEncSchemeURI="http://purl.org/dc/terms/LCSH">
       <dcx:valueString>Horse-drawn vehicles -- Queensland -- Atherton</dcx:valueString>
     </dc:subject>
     <dc:type dcx:vocabEncSchemeURI="http://purl.org/dc/terms/DCMIType"
              dcx:valueURI="http://purl.org/dc/dcmitype/Image">
       <dcx:valueString>Image</dcx:valueString>
     </dc:type>
     <dcterms:isReferencedBy xsi:type="dcap:FooIsRefByStatement" 
                             dcx:valueURI="http://example.org/bar/1" />
   </dcx:description>

   <dcx:description xsi:type="dcap:BarDescription" 
                    dcx:resourceURI="http://example.org/bar/1">
                    
   </dcx:description>

 </dcx:descriptionSet>

XML Example 4: Referencing the derived complex type for the Statement Element

3.3.2 Example Schemas and Instances

The schema theirdcap.xsd example schema defines a complex type which restricts the content of the Statement Element for the dcterms:isReferencedBy property. The instance ex7.xml validates against the theirdcap.xsd schema.

3.4 Constraining the Content of a Value Representation

3.4.1 Constraining the Content of a Value String

An application may derive an XML Schema complex type that restricts the default type for the dcx:valueString XML element. This derived complex type is referenced in the XML instance using the xsi:type attribute.

In this example, the content is limited to the set of value strings associated with the classes of the DCMI Type Vocabulary.

   <xs:complexType name="DCMITypeValueString">
     <xs:simpleContent>
       <xs:restriction base="dcx:ValueStringElement">
         <xs:simpleType>
           <xs:restriction base="dcmitype:TypeString" />
         </xs:simpleType>
       </xs:restriction>
     </xs:simpleContent>
   </xs:complexType>

XSD Example 11: Deriving a restricted complex type for the Value String Element

<?xml version="1.0" encoding="UTF-8"?> 
<dcx:descriptionSet
          xsi:type="dcap:FooBarDescriptionSet"
          xmlns:dc="http://purl.org/dc/elements/1.1/"
          xmlns:dcterms="http://purl.org/dc/terms/"
          xmlns:dcx="http://purl.org/dc/xml/"
          xmlns:dcap="http://example.org/their/dc/xml/theirap/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://example.org/their/dc/xml/theirap/ ../xmls/theirdcap.xsd" 
>

   <dcx:description xsi:type="dcap:FooDescription" 
                    dcx:resourceURI="http://example.org/foo/1">
     <dc:title>
       <dcx:valueString xml:lang="en-GB">First foo</dcx:valueString>
     </dc:title>
     <dc:subject dcx:vocabEncSchemeURI="http://purl.org/dc/terms/LCSH">
       <dcx:valueString>Horse-drawn vehicles -- Queensland -- Atherton</dcx:valueString>
     </dc:subject>
     <dc:type dcx:vocabEncSchemeURI="http://purl.org/dc/terms/DCMIType"
              dcx:valueURI="http://purl.org/dc/dcmitype/Image">
       <dcx:valueString xsi:type="dcap:DCMITypeValueString">Image</dcx:valueString>
     </dc:type>
     <dcterms:isReferencedBy xsi:type="dcap:FooIsRefByStatement" 
                             dcx:valueURI="http://example.org/bar/1" />
   </dcx:description>
   
   <dcx:description xsi:type="dcap:BarDescription" 
                    dcx:resourceURI="http://example.org/bar/1">
                    
   </dcx:description>
   
 </dcx:descriptionSet>

XML Example 5: Referencing the derived complex type for the Value String Element

3.4.1.1 Example Schemas and Instances

The schema theirdcap.xsd example schema defines a complex type which restricts the content of the Value String Element for the dc:type property. The instance ex7.xml validates against the theirdcap.xsd schema.

3.4.2 Constraining the Content of an XML Representation

An application may derive an XML Schema complex type that restricts the default type for the dcx:XMLRepresentation XML element. This derived complex type is referenced in the XML instance using the xsi:type attribute.

In this example, the content is limited to a single XHTML element.

   <xs:complexType name="WFXHTMLRepresentation">
     <xs:complexContent>
       <xs:restriction base="dcx:XMLRepresentationElement">
         <xs:sequence>
           <xs:any namespace="http://www.w3.org/1999/xhtml" minOccurs="1" maxOccurs="1" processContents="lax"/>
         </xs:sequence>
       </xs:restriction>
     </xs:complexContent>
   </xs:complexType>

XSD Example 12: Deriving a restricted complex type for the XML Representation Element

<?xml version="1.0" encoding="UTF-8"?>
<dcx:descriptionSet
          xsi:type="dcap:FooBarDescriptionSet"
          xmlns:dc="http://purl.org/dc/elements/1.1/"
          xmlns:dcterms="http://purl.org/dc/terms/"
          xmlns:dcx="http://purl.org/dc/xml/"
          xmlns:dcap="http://example.org/your/dc/xml/yourap/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://example.org/their/dc/xml/theirap/ ../xmls/theirdcap.xsd" 
>
   <dcx:description xsi:type="dcap:FooDescription" 
                    dcx:resourceURI="http://example.org/foo/1">

   </dcx:description>

   <dcx:description xsi:type="dcap:BarDescription" 
                    dcx:resourceURI="http://example.org/bar/1">
     <dc:title>
       <dcx:valueString xml:lang="en-GB">First bar</dcx:valueString>
     </dc:title>
     <dc:type dcx:vocabEncSchemeURI="http://purl.org/dc/terms/DCMIType"
              dcx:valueURI="http://purl.org/dc/dcmitype/Text">
       <dcx:valueString>Text</dcx:valueString>
     </dc:type>
     <dc:creator dcx:valueURI="http://example.org/person/john">
       <dcx:valueString>John Smith</dcx:valueString>
       <dcx:valueString>Smith, John</dcx:valueString>
     </dc:creator>
     <dc:publisher dcx:valueURI="http://example.org/organisation/bigco">
       <dcx:valueString>Big Co</dcx:valueString>
     </dc:publisher>
     <dc:description>
       <dcx:XMLRepresentation xsi:type="dcap:WFXHTMLRepresentation">
        <div xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
          <p>First bar is the occasional newsletter of <a title="Big Co" href="http://bigco.example.org/">Big Co</a>.</p>
        </div>
       </dcx:XMLRepresentation>
     </dc:description>
   </dcx:description>

</dcx:descriptionSet>

XML Example 7: Referencing the derived complex type for the XML Representation Element

3.4.2.1 Example Schemas and Instances

The schema theirdcap.xsd example schema defines a complex type which restricts the content of the XML Representation Element for the dc:description property. The instance ex7.xml validates against the theirdcap.xsd schema.

Appendix A: Examples

The examples referred to in this document are listed together on the following pages

Notes

[1] DC-XML is one XML format for representing DC metadata description sets in XML. Other such formats may exist. For example, the Open Archives Initiative Protocol for Metadata Harvesting [OAIPMH] defines a format, commonly known as oai_dc, which supports the serialisation of DC description sets containing a single description, with statements referencing only the fifteen properties of the DCMES, and using value strings only.

References

[DCXML]
Expressing Dublin Core metadata using XML. Working Draft of 2006-05-29.
http://dublincore.org/documents/dc-xml/2006-05-29/

[DCAM]
DCMI Abstract Model
http://dublincore.org/documents/abstract-model/

[XML]
Extensible Markup Language (XML) 1.0 (Third Edition). W3C Recommendation 04 February 2004.
http://www.w3.org/TR/REC-xml

[XMLSCHEMA-0]
XML Schema Part 0: Primer Second Edition. W3C Recommendation 28 October 2004.
http://www.w3.org/TR/xmlschema-0/

[XMLSCHEMA-1]
XML Schema Part 1: Structures Second Edition. W3C Recommendation 28 October 2004.
http://www.w3.org/TR/xmlschema-1/

[XMLSCHEMA-2]
XML Schema Part 2: Datatypes Second Edition. W3C Recommendation 28 October 2004.
http://www.w3.org/TR/xmlschema-2/

[OAIPMH]
The Open Archives Initiative Protocol for Metadata Harvesting Protocol Version 2.0 of 2002-06-14.
http://www.openarchives.org/OAI/openarchivesprotocol.html

[DC-TEXT]
DC-Text: A Text Syntax for Dublin Core Metadata Draft of 2006-05-24.
http://dublincore.org/architecturewiki/DCText/2006-05-24