Example xs:IDREFS

In this example we define an element 'foo' whose content type is an xs:ID so the foo element itself is implicated in the naming. The 'bar' element is of type xs:IDREFS; a list of IDREFs. The IDREF type is not used directly as a datatype (because this has document scope), but becomes a global resource URI.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        targetNamespace="http://example.org/" elementFormDefault="qualified">
        
        <xs:element name="list">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="foo" type="xs:ID" />
                                <xs:element name="bar" type="xs:IDREFS" />
                        </xs:sequence>
                </xs:complexType>
        </xs:element>

</xs:schema>

The 'bar' element refers twice to the same ID.

<?xml version="1.0" encoding="UTF-8"?>
<list xmlns="http://example.org/">
        <foo>foobar</foo>
        <bar>foobar foobar</bar>
</list>

In N3 the content of an RDF list is contained in brackets.

# Base: http://example.org/elementIDREFS.xml
@prefix ns1:     <http://example.org/def/> .
@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:list
              [ ns2:bar (:foobar :foobar) ;
                ns2:foo :foobar
              ] .

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