attributeGroup

Attribute groups allow the schema designer to collect together common groups of attributes. The example below is based on the XML Linking standard XLink which defines groups of attributes that define a number of link properties including xlink:href and xlink:type that we will see here.

<?xml version="1.0" encoding="UTF-8"?>
<link xmlns="http://example.org/" xmlns:xlink="http://www.w3.org/1999/xlink" 
        xlink:href="foo.xml" />

The xlink:href attribute is of type xs:anyURI, and this is resolved against the document base to provide an absolute URI that retains its meaning in RDF. However, it remains a literal of type xs:anyURI.

# Base: http://example.org/link.xml
@prefix xlink_:  <http://www.w3.org/1999/xlink#> .
@prefix ns1:     <http://example.org/def/> .
@prefix xlink:   <http://www.w3.org/1999/xlink> .
@prefix xs:      <http://www.w3.org/2001/XMLSchema> .
@prefix ns2:     <http://example.org/> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xs_:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <#> .

<>    ns2:link
              [ xlink_:href "http://example.org/foo.xml"^^xs_:anyURI ;
                xlink_:type "simple"^^xs_:string
              ] .

For brevity only the attributeGroup reference is included here. The simpleLink attribute group also defines a fixed xlink:type attribute that has an implied value of 'simple' which is added to the RDF model even though it is not explicit in the XML.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/" xmlns:xlink="http://www.w3.org/1999/xlink">
        <xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink.xsd" />

        <xs:element name="link">
                <xs:complexType>
                        <xs:attributeGroup ref="xlink:simpleLink"/>
                </xs:complexType>
        </xs:element>

</xs:schema>

See also:
http://www.w3.org/1999/xlink

Child components


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