Example of XML File and Associated Ruleset

XML file (simple_note.xml) for a simple note including a reference to a schema file:

<?xml version="1.0"?>
<?oxygen RNGSchema="simple_note.rnc" type="compact"?>

<note type="reminder">
   <to>Greg</to>
   <from>Martin</from>
   <date>2007-05-19</date>
   <heading>Reminder</heading>
   <body>You owe me five bucks</body>
</note>
		

Schema file (simple_note.rnc) specifying what elements and attributes are allowed:

default namespace = ""

start =
  element note {
    attribute type { text },
    element to { text },
    element from { text },
    element date { xsd:date },
    element heading { text },
    element body { text }
  }