default namespace = "http://plone.org/ns/archetypes/"
namespace cmf = "http://cmf.zope.org/namespaces/default/"
namespace dc = "http://purl.org/dc/elements/1.1/"
namespace note = "atxml:annotations"
namespace xmp = "adobe:ns:meta"

start = Metadata
MetaMeta =
  attribute filename { text }?,
  attribute content_type { text }?,
  attribute transfer_encoding { text }?
DublinCore =
  element dc:title { text }*
  | element dc:description { MetaMeta, text }*
  | element dc:subject { text }*
  | element dc:contributor { xsd:string }*
  | element dc:creator { xsd:string }+
  | element dc:language { xsd:language }*
  | element dc:rights { MetaMeta, text }*
DateInfo =
  element xmp:CreateDate { xsd:dateTime }*,
  element xmp:ModifyDate { xsd:dateTime }*
ArchetypesFields =
  [
    note:info [
      "\x{a}" ~
      "        All non-standard Archetypes fields are represented by a 'field'\x{a}" ~
      "        element, their id specified by an attribute 'id'.\x{a}" ~
      "      "
    ]
  ]
  element field {
    attribute id { text },
    MetaMeta,
    (text
     | [
         note:info [
           "\x{a}" ~
           "              References can be made by UID (Archetypes),\x{a}" ~
           "              relative path, or by specifying a group of values\x{a}" ~
           "              that can uniquely identify a piece of content.\x{a}" ~
           "            "
         ]
       ]
       element reference {
         element uid { text }*
         | element path { text }*
         | Metadata*
       }*)
  }
Metadata =
  element metadata {
    # does not explicitly allow 'xml:lang' attribute
    element cmf:type { text }?
    & element uid { text }?
    & DublinCore*
    & DateInfo*
    & ArchetypesFields*
  }
