\hypertarget{elementENTITY}{}\subsection{Example xs:ENTITY}\label{elementENTITY}
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 {\em 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.



\begin{DocInclude}\begin{verbatim}<?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>
\end{verbatim}
\end{DocInclude}


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



\begin{DocInclude}\begin{verbatim}<?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>
\end{verbatim}
\end{DocInclude}


The rdf:XMLLiteral type is used in conjunction with the 'Literal' parse\-Type of the rdf/xml serialization. The base is \href{http://example.org/base.}{\tt http://example.org/base.}



\begin{DocInclude}\begin{verbatim}<?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>
\end{verbatim}
\end{DocInclude}
 