simpleContent

Simple content lets us add attributes to an element that otherwise has content representing a single value.

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

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.org/">
        
        <xs:element name="foo">
                <xs:complexType>
                        <xs:simpleContent>
                                <xs:extension base="xs:string"/>
                        </xs:simpleContent>
                        <xs:attribute name="bar" />
                </xs:complexType>
        </xs:element>

</xs:schema>

Note how the content and named properties derived from attributes share the same subject. The content is differentiated from attributes by the use of the rdf:value property.

# Base: http://example.org/simpleContent.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:foo [ rdf:value "foo"^^xs_:string ;
                ns1:bar "bar"
              ] .

Child components


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