Skip to content

Instantly share code, notes, and snippets.

@takahashim
Created May 4, 2010 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takahashim/389163 to your computer and use it in GitHub Desktop.
Save takahashim/389163 to your computer and use it in GitHub Desktop.
# OPF2.0 schema in relaxng compact syntax
# generated by RngToRncText.xsl (RngToRnc 1.4) http://www.pantor.com/download.html
#
default namespace opf = "http://www.idpf.org/2007/opf"
namespace dc = "http://purl.org/dc/elements/1.1/"
start = OPF20.package-element
OPF20.optional-id-attribute = attribute id { xsd:ID }?
OPF20.optional-xml-lang-attribute = attribute lang { text }?
OPF20.optional-file-as-attribute = attribute file-as { text }?
OPF20.optional-role-attribute = attribute role { text }?
OPF20.optional-scheme-attribute = attribute scheme { text }?
OPF20.optional-event-attribute = attribute event { text }?
OPF20.optional-xsi-type = attribute type { text }?
OPF20.package-element =
element package
{
attribute version { "2.0" },
attribute unique-identifier { xsd:IDREF },
OPF20.optional-id-attribute,
OPF20.package-content
}
OPF20.package-content =
OPF20.metadata-element,
OPF20.manifest-element,
OPF20.spine-element,
OPF20.tours-element?,
OPF20.guide-element?
OPF20.metadata-element =
element metadata { OPF20.optional-id-attribute, OPF20.metadata-content }
OPF20.metadata-content =
( OPF20.dc-metadata-element & OPF20.x-metadata-element? )
| (
DC.title-element+
& DC.language-element+
& DC.identifier-element+
& DC.optional-metadata-element*
& OPF20.meta-element*
& OPF20.any-other-element*
)
OPF20.dc-metadata-element =
element dc-metadata
{
OPF20.optional-id-attribute,
OPF20.dc-metadata-content
}
OPF20.dc-metadata-content =
DC.title-element+
& DC.language-element+
& DC.identifier-element+
& DC.optional-metadata-element*
DC.identifier-element =
element dc:identifier
{
attribute id { xsd:ID }?,
OPF20.optional-xsi-type,
OPF20.optional-scheme-attribute,
DC.metadata-common-content
}
DC.title-element =
element dc:title
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
DC.metadata-common-content
}
DC.language-element =
element dc:language
{
OPF20.optional-id-attribute,
OPF20.optional-xsi-type,
DC.metadata-common-content
}
DC.optional-metadata-element =
element dc:contributor
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
OPF20.optional-file-as-attribute,
OPF20.optional-role-attribute,
DC.metadata-common-content
}
| element dc:coverage
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
DC.metadata-common-content
}
| element dc:creator
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
OPF20.optional-file-as-attribute,
OPF20.optional-role-attribute,
DC.metadata-common-content
}
| element dc:date
{
OPF20.optional-id-attribute,
OPF20.optional-xsi-type,
OPF20.optional-event-attribute,
DC.metadata-common-content
}
| element dc:description
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
DC.metadata-common-content
}
| element dc:format
{
OPF20.optional-id-attribute,
OPF20.optional-xsi-type,
DC.metadata-common-content
}
| element dc:publisher
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
DC.metadata-common-content
}
| element dc:relation
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
DC.metadata-common-content
}
| element dc:rights
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
DC.metadata-common-content
}
| element dc:source
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
DC.metadata-common-content
}
| element dc:subject
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
DC.metadata-common-content
}
| element dc:type
{
OPF20.optional-id-attribute,
OPF20.optional-xsi-type,
DC.metadata-common-content
}
DC.metadata-common-content = text
OPF20.x-metadata-element =
element x-metadata { OPF20.optional-id-attribute, OPF20.x-metadata-content }
OPF20.x-metadata-content = OPF20.meta-element* & OPF20.any-other-element*
OPF20.meta-element =
element meta
{
OPF20.optional-id-attribute,
OPF20.optional-xml-lang-attribute,
attribute name { text },
attribute content { text },
attribute scheme { text }?,
OPF20.meta-content
}
OPF20.meta-content = empty
OPF20.manifest-element =
element manifest { OPF20.optional-id-attribute, OPF20.manifest-content }
OPF20.manifest-content = OPF20.item-element+
OPF20.item-element =
element item
{
attribute id { xsd:ID },
attribute href { text },
attribute media-type { text },
attribute fallback { xsd:IDREF }?,
attribute fallback-style { xsd:IDREF }?,
(
attribute required-namespace { text },
attribute required-modules { text }?
)?,
OPF20.item-content
}
OPF20.item-content = empty
OPF20.spine-element =
element spine
{
OPF20.optional-id-attribute,
attribute toc { xsd:IDREF },
OPF20.spine-content
}
OPF20.spine-content = OPF20.itemref-element+
OPF20.itemref-element =
element itemref
{
OPF20.optional-id-attribute,
attribute idref { xsd:IDREF },
attribute linear { "yes" | "no" }?,
OPF20.itemref-content
}
OPF20.itemref-content = empty
OPF20.tours-element =
element tours { OPF20.optional-id-attribute, OPF20.tours-content }
OPF20.tours-content = OPF20.tour-element+
OPF20.tour-element =
element tour
{
OPF20.optional-id-attribute,
attribute title { text },
OPF20.tour-content
}
OPF20.tour-content = OPF20.site-element+
OPF20.site-element =
element site
{
OPF20.optional-id-attribute,
attribute title { text },
attribute href { text },
OPF20.site-content
}
OPF20.site-content = empty
OPF20.guide-element =
element guide { OPF20.optional-id-attribute, OPF20.guide-content }
OPF20.guide-content = OPF20.reference-element*
OPF20.reference-element =
element reference
{
OPF20.optional-id-attribute,
attribute type { text },
attribute title { text }?,
attribute href { text },
OPF20.reference-content
}
OPF20.reference-content = empty
OPF20.any-other-element =
element * - (opf:* | dc:*)
{
( attribute * { text } | text | OPF20.any-other-element )*
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment