Example xs:ENTITY

Entities allow common blocks of text to be substituted in place, reducing duplication and errors. Entities are not just any plain text, but may also contain balanced markup. This fits the bill of the rdf:XMLLiteral datatype. Entity references are usually identified by surrounding them with '&' and ';', allowing the XML parser to expand them, but this is not required for the schema entity type.

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

An XML instance that defines and uses an entity 'eg' is as follows:

<?xml version="1.0"?>
<!DOCTYPE example [
        <!ELEMENT entity (#PCDATA)>
        <!ATTLIST entity xmlns CDATA #IMPLIED xmlns:xsi CDATA #IMPLIED xsi:schemaLocation CDATA #IMPLIED>
        <!ENTITY eg "http://example.com/">
]>
<entity xmlns="http://example.org/">eg</entity>

The rdf:XMLLiteral type is used in conjunction with the 'Literal' parseType of the rdf/xml serialization. The base is http://example.org/base.

<?xml version="1.0" encoding="windows-1252"?>
<rdf:RDF
    xmlns:ns1="http://example.org/def/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:ns2="http://example.org/"
    xmlns:xs_="http://www.w3.org/2001/XMLSchema#"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <rdf:Description rdf:about="">
    <ns2:entity rdf:parseType="Literal">http://example.com/</ns2:entity>
  </rdf:Description>
</rdf:RDF>

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