xsi:nil

XML differentiates between empty and null data. Such nillable elements can be described in the XML schema.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.org/">
        <xs:element name="foobar" type="xs:String" nillable="true"/>
</xs:schema>

An example of a nil element is shown in the example below. A null value is represented in RDF using rdf:nil, the empty list.

<?xml version="1.0" encoding="UTF-8"?>
<foobar xmlns="http://example.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:nil="true"/>

# Base: http://example.org/nil.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:foobar () .

Compare this with the same element simply left empty.

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

# Base: http://example.org/nil1.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:foobar "" .

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