Example: xs:NOTATION

This example demonstrates the use of notations. These are essentially QNames which must be expanded to give them global scope. The only restriction is that any notation should be predefined in the schema. The example includes a base64Binary embedded image which is notated as belonging to a particular predefined mime type.

<?xml version="1.0"?>
<!-- example adapted from http://www.w3.org/TR/2004/WD-xml-media-types-20041102/ -->
<notation xmlns="http://www.iana.org/assignments/media-types/image/" 
        mimeType="png">/aWKKapGGyQ=</notation>

The xml schema defines the mime options is as follows. The only mime type options available are 'jpeg', 'gif' and 'png'.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        targetNamespace="http://www.iana.org/assignments/media-types/image/" 
        xmlns="http://www.iana.org/assignments/media-types/image/">
                
        <xs:notation name="jpeg" public="image/jpeg"/>
        <xs:notation name="gif" public="image/gif" />
        <xs:notation name="png" public="image/png" />
        
        <xs:element name="notation">
                <xs:complexType>
                        <xs:complexContent>
                                <xs:extension base="xs:base64Binary">
                                        <xs:attribute name="mimeType">
                                                <xs:simpleType >
                                                        <xs:restriction base="xs:NOTATION">
                                                                <xs:enumeration value="jpeg"/>
                                                                <xs:enumeration value="gif"/>
                                                                <xs:enumeration value="png"/>
                                                        </xs:restriction>
                                                </xs:simpleType>
                                        </xs:attribute>
                                </xs:extension>
                        </xs:complexContent>
                </xs:complexType>
        </xs:element>

</xs:schema>

In the resulting RDF mapping, the xs:NOTATION datatype does not appear, but the expanded QName names the global mime type resource.

# Base: http://example.org/attributeNotation.xml
@prefix ns1:     <http://www.iana.org/assignments/media-types/image/> .
@prefix xs:      <http://www.w3.org/2001/XMLSchema> .
@prefix ns2:     <http://example.org/def/> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xs_:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <#> .

<>    ns1:notation
              [ rdf:value "/aWKKapGGyQ="^^xs_:base64Binary ;
                ns2:mimeType ns1:png
              ] .

Child components


Generated on Mon Jun 18 16:02:37 2007 for Gloze by  doxygen 1.5.0