Using XML in Property Elements

Although property values are mostly text or resources that you reference, they can also be straight XML. In that case, you just set the parseType attribute of the property to "Literal".

For example, I'm using my own XML elements, such as <BirthCity> and <BirthCountry> in the <Creator> property here, and giving them their own namespace: ns:

Listing . ch18_09.rdf
 
<?xml version="1.0" ?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://www.purl.org/DC/"
    xmlns:ns="http://www.starpowder.com/namespace/">

    <rdf:Description about="http://www.starpowder.com/planets.html">
        <dc:Creator parseType="Literal">
					<ns:FirstName>Nicolas</nm:FirstName>
					<ns:LastName>Copernicus</nm:LastName>
					<ns:Birth>1473</nm:Birth> ...

Get Real World XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.