diff options
| author | massifrg <[email protected]> | 2025-06-16 01:14:36 +0200 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2025-07-26 22:45:11 -0700 |
| commit | fe3684632b543b3d8a6b23de9da42dd87daedde7 (patch) | |
| tree | 279ea56f1c2d06c8e9db2e1b144013ac0baa8ec4 /tools | |
| parent | cf11339c1d3add1c4d758d0107d714b5954584fe (diff) | |
New `xml` format exactly representing a Pandoc AST.
This adds a reader and writer for an XML format equivalent to `native`
and `json`.
XML schemas for validation can be found in `tools/pandoc-xml.*`.
The format is documented in `doc/xml.md`.
API changes:
- Add module Text.Pandoc.Readers.XML, exporting `readXML`.
- Add module Text.Pandoc.Writers.XML, exporting `writeXML`.
A new unexported module Text.Pandoc.XMLFormat is also added.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/pandoc-xml.dtd | 181 | ||||
| -rw-r--r-- | tools/pandoc-xml.rnc | 250 | ||||
| -rw-r--r-- | tools/pandoc-xml.rng | 913 | ||||
| -rw-r--r-- | tools/pandoc-xml.xsd | 602 |
4 files changed, 1946 insertions, 0 deletions
diff --git a/tools/pandoc-xml.dtd b/tools/pandoc-xml.dtd new file mode 100644 index 000000000..e787596ed --- /dev/null +++ b/tools/pandoc-xml.dtd @@ -0,0 +1,181 @@ +<!-- +A DTD for Pandoc XML format. +Copyright : Copyright (C) 2025- Massimiliano Farinella +License : GNU GPL, version 2 or above +Maintainer : Massimiliano Farinella <[email protected]> + +This is a DTD for the XML representation of Pandoc AST. +It's an equivalent of native and JSON formats, but modeled as XML. +You can validate Pandoc XML documents with this DTD, +but there are some limitations: +- a Pandoc Attr can contain arbitrary attributes, but it looks like you can't tell + an element has arbitrary attributes in a DTD +- some Pandoc attributes have constraints that can't be specified with a DTD +The Relax-NG and XML Schema translations of this specification overcome +some of those limitations (see pandoc-xml.rng and pandoc-xml.xsd). +--> +<!ELEMENT Pandoc (meta, blocks)> +<!ATTLIST Pandoc api-version CDATA #REQUIRED> + +<!ENTITY % block "Para | Plain | Header | Div | BlockQuote | HorizontalRule | BulletList | OrderedList | DefinitionList | Table | Figure | LineBlock | CodeBlock | RawBlock"> + +<!ENTITY % inline_element "Str | Space | Emph | Strong | Underline | Strikeout | Superscript | Subscript | SmallCaps | Quoted | Cite | Code | SoftBreak | LineBreak | Math | RawInline | Link | Image | Note | Span"> +<!ENTITY % inline "#PCDATA | %inline_element;"> + +<!ENTITY % attr "id ID #IMPLIED class CDATA #IMPLIED"> + +<!ENTITY % metavalue "MetaMap | MetaList | MetaBool | MetaString | MetaInlines | MetaBlocks"> + +<!ELEMENT meta (entry*)> +<!ELEMENT MetaMap (entry*)> + +<!ELEMENT entry (%metavalue;)*> +<!ATTLIST entry key CDATA #REQUIRED> + +<!ELEMENT MetaList (%metavalue;)*> + +<!ELEMENT MetaBool EMPTY> +<!ATTLIST MetaBool value (true | false) #REQUIRED> + +<!ELEMENT MetaString (#PCDATA)> + +<!ELEMENT MetaInlines (%inline;)*> + +<!ELEMENT MetaBlocks (%block;)*> + +<!ELEMENT blocks (%block;)*> + +<!ELEMENT Para (%inline;)*> + +<!ELEMENT Plain (%inline;)*> + +<!ELEMENT Header (%inline;)*> +<!ATTLIST Header + level CDATA "1" + %attr;> + +<!ELEMENT Div (%block;)* > +<!ATTLIST Div + custom-style CDATA #IMPLIED + %attr;> + +<!ELEMENT BlockQuote (%block;)*> + +<!ELEMENT HorizontalRule EMPTY> + +<!ELEMENT BulletList (item)+> + +<!ELEMENT OrderedList (item)+> +<!ATTLIST OrderedList + start CDATA "1" + number-style (DefaultStyle | Example | Decimal | LowerRoman | UpperRoman | LowerAlpha | UpperAlpha) "DefaultStyle" + number-delim (DefaultDelim | Period | OneParen | TwoParens) "DefaultDelim"> + +<!ELEMENT DefinitionList (item)+> + +<!ELEMENT item ((%block;)*|(term,def+))> +<!ELEMENT term (%inline;)*> +<!ELEMENT def (%block;)*> + +<!ELEMENT Table (Caption, colspecs, TableHead, TableBody+, TableFoot)> +<!ATTLIST Table + custom-style CDATA #IMPLIED + %attr;> +<!ELEMENT Caption (ShortCaption?, (%block;)*)> +<!ELEMENT ShortCaption (%inline;)*> +<!ELEMENT colspecs (ColSpec+)> +<!ELEMENT ColSpec EMPTY> +<!ATTLIST ColSpec + alignment (AlignLeft | AlignRight | AlignCenter | AlignDefault) "AlignDefault" + col-width CDATA "0"> +<!ELEMENT TableHead (Row*)> +<!ATTLIST TableHead %attr;> +<!ELEMENT TableFoot (Row*)> +<!ATTLIST TableFoot %attr;> +<!ELEMENT TableBody (header, body)> +<!ATTLIST TableBody + row-head-columns CDATA "0" + %attr;> +<!ELEMENT header (Row*)> +<!ELEMENT body (Row*)> +<!ELEMENT Row (Cell*)> +<!ATTLIST Row %attr;> +<!ELEMENT Cell (%block;)*> +<!ATTLIST Cell + alignment (AlignLeft | AlignRight | AlignCenter | AlignDefault) "AlignDefault" + row-span CDATA "1" + col-span CDATA "1" + %attr; > + +<!ELEMENT Figure (Caption,(%block;)*)> +<!ATTLIST Figure %attr;> + +<!ELEMENT LineBlock (line+)> +<!ELEMENT line (%inline;)*> + +<!ELEMENT CodeBlock (#PCDATA)> +<!ATTLIST CodeBlock %attr;> + +<!ELEMENT RawBlock (#PCDATA)> +<!ATTLIST RawBlock format CDATA #REQUIRED> + +<!ELEMENT Space EMPTY> +<!ATTLIST Space count CDATA "1"> + +<!ELEMENT Str EMPTY> +<!ATTLIST Str content CDATA ""> + +<!ELEMENT Emph (%inline;)*> +<!ELEMENT Strong (%inline;)*> +<!ELEMENT Underline (%inline;)*> +<!ELEMENT Strikeout (%inline;)*> +<!ELEMENT Superscript (%inline;)*> +<!ELEMENT Subscript (%inline;)*> +<!ELEMENT SmallCaps (%inline;)*> + +<!ELEMENT Span (%inline;)*> +<!ATTLIST Span + custom-style CDATA #IMPLIED + %attr;> + +<!ELEMENT Quoted (%inline;)*> +<!ATTLIST Quoted quote-type (SingleQuote | DoubleQuote) "DoubleQuote"> + +<!ELEMENT Math (#PCDATA)> +<!ATTLIST Math math-type (DisplayMath | InlineMath) "InlineMath"> + +<!ELEMENT RawInline (#PCDATA)> +<!ATTLIST RawInline format CDATA #REQUIRED> + +<!ELEMENT Cite (#PCDATA | citations | %inline_element;)*> +<!ELEMENT citations (Citation)+> +<!ELEMENT Citation (prefix?, suffix?)> +<!ELEMENT prefix (%inline;)*> +<!ELEMENT suffix (%inline;)*> +<!ATTLIST Citation + id CDATA #IMPLIED + note-num CDATA #IMPLIED + hash CDATA "0" + mode (AuthorInText | SuppressAuthor | NormalCitation) "AuthorInText"> + +<!ELEMENT Code (#PCDATA)> +<!ATTLIST Code %attr;> + +<!ENTITY % target "title CDATA #IMPLIED url CDATA #IMPLIED"> + +<!ELEMENT Image (%inline;)*> +<!ATTLIST Image + title CDATA #IMPLIED + src CDATA #IMPLIED + %attr;> + +<!ELEMENT Link (%inline;)*> +<!ATTLIST Link + title CDATA #IMPLIED + href CDATA #IMPLIED + %attr;> + +<!ELEMENT SoftBreak EMPTY> +<!ELEMENT LineBreak EMPTY> + +<!ELEMENT Note (%block;)*> diff --git a/tools/pandoc-xml.rnc b/tools/pandoc-xml.rnc new file mode 100644 index 000000000..59043d650 --- /dev/null +++ b/tools/pandoc-xml.rnc @@ -0,0 +1,250 @@ +# A RELAX NG schema for Pandoc XML format. +# Copyright : Copyright (C) 2025- Massimiliano Farinella +# License : GNU GPL, version 2 or above +# Maintainer : Massimiliano Farinella <[email protected]> +# +# This is a RELAX NG schema for the XML representation of Pandoc AST. +# It's an equivalent of native and JSON formats, but modeled as XML. +# You can use this schema to validate Pandoc XML documents. +# It's translated from pandoc-xml.dtd with the "Trang" software by James Clark, +# and adjusted manually to add some constraints: +# - elements with Attr can have arbitrary attributes (this is not possible with a DTD) +# - Header's "level", OrderedList's "start" and Cell's "rowspan" and "colspan" attributes +# must be a positive integer and are equal to 1 if not specified +# - column widths in ColSpec must be between 0 and 1 (inclusive, with 0=ColWidthDefault) +# - the "count" attribute in the "<Space>" element must be positive and equal to 1 if not specified + +namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" + +Pandoc = element Pandoc { attlist_Pandoc, meta, blocks } +attlist_Pandoc &= attribute api-version { text } +block = + Para + | Plain + | Header + | Div + | BlockQuote + | HorizontalRule + | BulletList + | OrderedList + | DefinitionList + | Table + | Figure + | LineBlock + | CodeBlock + | RawBlock +inline_element = + Str + | Space + | Emph + | Strong + | Underline + | Strikeout + | Superscript + | Subscript + | SmallCaps + | Quoted + | Cite + | Code + | SoftBreak + | LineBreak + | Math + | RawInline + | Link + | Image + | Note + | Span +inline = text | inline_element +attr = + attribute id { xsd:ID }?, + attribute class { text }?, + attribute * { text }* +metavalue = + MetaMap | MetaList | MetaBool | MetaString | MetaInlines | MetaBlocks +meta = element meta { attlist_meta, entry* } +attlist_meta &= empty +MetaMap = element MetaMap { attlist_MetaMap, entry* } +attlist_MetaMap &= empty +entry = element entry { attlist_entry, metavalue* } +attlist_entry &= attribute key { text } +MetaList = element MetaList { attlist_MetaList, metavalue* } +attlist_MetaList &= empty +MetaBool = element MetaBool { attlist_MetaBool, empty } +attlist_MetaBool &= attribute value { "true" | "false" } +MetaString = element MetaString { attlist_MetaString, text } +attlist_MetaString &= empty +MetaInlines = element MetaInlines { attlist_MetaInlines, inline* } +attlist_MetaInlines &= empty +MetaBlocks = element MetaBlocks { attlist_MetaBlocks, block* } +attlist_MetaBlocks &= empty +blocks = element blocks { attlist_blocks, block* } +attlist_blocks &= empty +Para = element Para { attlist_Para, inline* } +attlist_Para &= empty +Plain = element Plain { attlist_Plain, inline* } +attlist_Plain &= empty +Header = element Header { attlist_Header, inline* } +attlist_Header &= + [ a:defaultValue = "1" ] attribute level { xsd:positiveInteger }?, + attr +Div = element Div { attlist_Div, block* } +attlist_Div &= attr +BlockQuote = element BlockQuote { attlist_BlockQuote, block* } +attlist_BlockQuote &= empty +HorizontalRule = + element HorizontalRule { attlist_HorizontalRule, empty } +attlist_HorizontalRule &= empty +BulletList = element BulletList { attlist_BulletList, item+ } +attlist_BulletList &= empty +OrderedList = element OrderedList { attlist_OrderedList, item+ } +attlist_OrderedList &= + [ a:defaultValue = "1" ] attribute start { xsd:positiveInteger }?, + [ a:defaultValue = "DefaultStyle" ] + attribute number-style { + "DefaultStyle" + | "Example" + | "Decimal" + | "LowerRoman" + | "UpperRoman" + | "LowerAlpha" + | "UpperAlpha" + }?, + [ a:defaultValue = "DefaultDelim" ] + attribute number-delim { + "DefaultDelim" | "Period" | "OneParen" | "TwoParens" + }? +DefinitionList = + element DefinitionList { attlist_DefinitionList, item+ } +attlist_DefinitionList &= empty +item = + element item { + attlist_item, + (block* | (term, def+)) + } +attlist_item &= empty +term = element term { attlist_term, inline* } +attlist_term &= empty +def = element def { attlist_def, block* } +attlist_def &= empty +Table = + element Table { + attlist_Table, Caption, colspecs, TableHead, TableBody+, TableFoot + } +attlist_Table &= attr +Caption = element Caption { attlist_Caption, ShortCaption?, block* } +attlist_Caption &= empty +ShortCaption = element ShortCaption { attlist_ShortCaption, inline* } +attlist_ShortCaption &= empty +colspecs = element colspecs { attlist_colspecs, ColSpec+ } +attlist_colspecs &= empty +ColSpec = element ColSpec { attlist_ColSpec, empty } +attlist_ColSpec &= + [ a:defaultValue = "AlignDefault" ] + attribute alignment { + "AlignLeft" | "AlignRight" | "AlignCenter" | "AlignDefault" + }?, + [ a:defaultValue = "0" ] + attribute col-width { + xsd:double { minInclusive = "0" maxInclusive = "1" } + }? +TableHead = element TableHead { attlist_TableHead, Row* } +attlist_TableHead &= attr +TableFoot = element TableFoot { attlist_TableFoot, Row* } +attlist_TableFoot &= attr +TableBody = element TableBody { attlist_TableBody, header, body } +attlist_TableBody &= + [ a:defaultValue = "0" ] attribute row-head-columns { text }?, + attr +header = element header { attlist_header, Row* } +attlist_header &= empty +body = element body { attlist_body, Row* } +attlist_body &= empty +Row = element Row { attlist_Row, Cell* } +attlist_Row &= attr +Cell = element Cell { attlist_Cell, block* } +attlist_Cell &= + [ a:defaultValue = "AlignDefault" ] + attribute alignment { + "AlignLeft" | "AlignRight" | "AlignCenter" | "AlignDefault" + }?, + [ a:defaultValue = "1" ] attribute row-span { xsd:positiveInteger }?, + [ a:defaultValue = "1" ] attribute col-span { xsd:positiveInteger }?, + attr +Figure = element Figure { attlist_Figure, Caption, block* } +attlist_Figure &= attr +LineBlock = element LineBlock { attlist_LineBlock, line+ } +attlist_LineBlock &= empty +line = element line { attlist_line, inline* } +attlist_line &= empty +CodeBlock = element CodeBlock { attlist_CodeBlock, text } +attlist_CodeBlock &= attr +RawBlock = element RawBlock { attlist_RawBlock, text } +attlist_RawBlock &= attribute format { text } +Space = element Space { attlist_Space, empty } +attlist_Space &= + [ a:defaultValue = "1" ] attribute count { xsd:positiveInteger }? +Str = element Str { attlist_Str, empty } +attlist_Str &= [ a:defaultValue = "" ] attribute content { text }? +Emph = element Emph { attlist_Emph, inline* } +attlist_Emph &= empty +Strong = element Strong { attlist_Strong, inline* } +attlist_Strong &= empty +Underline = element Underline { attlist_Underline, inline* } +attlist_Underline &= empty +Strikeout = element Strikeout { attlist_Strikeout, inline* } +attlist_Strikeout &= empty +Superscript = element Superscript { attlist_Superscript, inline* } +attlist_Superscript &= empty +Subscript = element Subscript { attlist_Subscript, inline* } +attlist_Subscript &= empty +SmallCaps = element SmallCaps { attlist_SmallCaps, inline* } +attlist_SmallCaps &= empty +Span = element Span { attlist_Span, inline* } +attlist_Span &= attr +Quoted = element Quoted { attlist_Quoted, inline* } +attlist_Quoted &= + [ a:defaultValue = "DoubleQuote" ] + attribute quote-type { "SingleQuote" | "DoubleQuote" }? +Math = element Math { attlist_Math, text } +attlist_Math &= + [ a:defaultValue = "InlineMath" ] + attribute math-type { "DisplayMath" | "InlineMath" }? +RawInline = element RawInline { attlist_RawInline, text } +attlist_RawInline &= attribute format { text } +Cite = + element Cite { attlist_Cite, (text | citations | inline_element)* } +attlist_Cite &= empty +citations = element citations { attlist_citations, Citation+ } +attlist_citations &= empty +Citation = element Citation { attlist_Citation, prefix?, suffix? } +prefix = element prefix { attlist_prefix, inline* } +attlist_prefix &= empty +suffix = element suffix { attlist_suffix, inline* } +attlist_suffix &= empty +attlist_Citation &= + attribute id { text }?, + attribute note-num { text }?, + [ a:defaultValue = "0" ] attribute hash { text }?, + [ a:defaultValue = "AuthorInText" ] + attribute mode { + "AuthorInText" | "SuppressAuthor" | "NormalCitation" + }? +Code = element Code { attlist_Code, text } +attlist_Code &= attr +Image = element Image { attlist_Image, inline* } +attlist_Image &= + attribute title { text }?, + attribute src { text }?, + attr +Link = element Link { attlist_Link, inline* } +attlist_Link &= + attribute title { text }?, + attribute href { text }?, + attr +SoftBreak = element SoftBreak { attlist_SoftBreak, empty } +attlist_SoftBreak &= empty +LineBreak = element LineBreak { attlist_LineBreak, empty } +attlist_LineBreak &= empty +Note = element Note { attlist_Note, block* } +attlist_Note &= empty +start = Pandoc diff --git a/tools/pandoc-xml.rng b/tools/pandoc-xml.rng new file mode 100644 index 000000000..38188f781 --- /dev/null +++ b/tools/pandoc-xml.rng @@ -0,0 +1,913 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +A RELAX NG schema for Pandoc XML format. +Copyright : Copyright (C) 2025- Massimiliano Farinella +License : GNU GPL, version 2 or above +Maintainer : Massimiliano Farinella <[email protected]> + +This is a RELAX NG schema for the XML representation of Pandoc AST. +It's an equivalent of native and JSON formats, but modeled as XML. +You can use this schema to validate Pandoc XML documents. +It's translated from pandoc-xml.dtd with the "Trang" software by James Clark, +and adjusted manually to add some constraints: +- elements with Attr can have arbitrary attributes (this is not possible with a DTD) +- Header's "level", OrderedList's "start" and Cell's "rowspan" and "colspan" attributes + must be a positive integer and are equal to 1 if not specified +- column widths in ColSpec must be between 0 and 1 (inclusive, with 0=ColWidthDefault) +- the "count" attribute in the "<Space>" element must be positive and equal to 1 if not specified +--> +<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" + xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <define name="Pandoc"> + <element name="Pandoc"> + <ref name="attlist_Pandoc" /> + <ref name="meta" /> + <ref name="blocks" /> + </element> + </define> + <define name="attlist_Pandoc" combine="interleave"> + <attribute name="api-version" /> + </define> + <define name="block"> + <choice> + <ref name="Para" /> + <ref name="Plain" /> + <ref name="Header" /> + <ref name="Div" /> + <ref name="BlockQuote" /> + <ref name="HorizontalRule" /> + <ref name="BulletList" /> + <ref name="OrderedList" /> + <ref name="DefinitionList" /> + <ref name="Table" /> + <ref name="Figure" /> + <ref name="LineBlock" /> + <ref name="CodeBlock" /> + <ref name="RawBlock" /> + </choice> + </define> + <define name="inline_element"> + <choice> + <ref name="Str" /> + <ref name="Space" /> + <ref name="Emph" /> + <ref name="Strong" /> + <ref name="Underline" /> + <ref name="Strikeout" /> + <ref name="Superscript" /> + <ref name="Subscript" /> + <ref name="SmallCaps" /> + <ref name="Quoted" /> + <ref name="Cite" /> + <ref name="Code" /> + <ref name="SoftBreak" /> + <ref name="LineBreak" /> + <ref name="Math" /> + <ref name="RawInline" /> + <ref name="Link" /> + <ref name="Image" /> + <ref name="Note" /> + <ref name="Span" /> + </choice> + </define> + <define name="inline"> + <choice> + <text /> + <ref name="inline_element" /> + </choice> + </define> + <define name="attr"> + <optional> + <attribute name="id"> + <data type="ID" /> + </attribute> + </optional> + <optional> + <attribute name="class" /> + </optional> + <zeroOrMore> + <attribute> + <anyName /> + </attribute> + </zeroOrMore> + </define> + <define name="metavalue"> + <choice> + <ref name="MetaMap" /> + <ref name="MetaList" /> + <ref name="MetaBool" /> + <ref name="MetaString" /> + <ref name="MetaInlines" /> + <ref name="MetaBlocks" /> + </choice> + </define> + <define name="meta"> + <element name="meta"> + <ref name="attlist_meta" /> + <zeroOrMore> + <ref name="entry" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_meta" combine="interleave"> + <empty /> + </define> + <define name="MetaMap"> + <element name="MetaMap"> + <ref name="attlist_MetaMap" /> + <zeroOrMore> + <ref name="entry" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_MetaMap" combine="interleave"> + <empty /> + </define> + <define name="entry"> + <element name="entry"> + <ref name="attlist_entry" /> + <zeroOrMore> + <ref name="metavalue" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_entry" combine="interleave"> + <attribute name="key" /> + </define> + <define name="MetaList"> + <element name="MetaList"> + <ref name="attlist_MetaList" /> + <zeroOrMore> + <ref name="metavalue" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_MetaList" combine="interleave"> + <empty /> + </define> + <define name="MetaBool"> + <element name="MetaBool"> + <ref name="attlist_MetaBool" /> + <empty /> + </element> + </define> + <define name="attlist_MetaBool" combine="interleave"> + <attribute name="value"> + <choice> + <value>true</value> + <value>false</value> + </choice> + </attribute> + </define> + <define name="MetaString"> + <element name="MetaString"> + <ref name="attlist_MetaString" /> + <text /> + </element> + </define> + <define name="attlist_MetaString" combine="interleave"> + <empty /> + </define> + <define name="MetaInlines"> + <element name="MetaInlines"> + <ref name="attlist_MetaInlines" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_MetaInlines" combine="interleave"> + <empty /> + </define> + <define name="MetaBlocks"> + <element name="MetaBlocks"> + <ref name="attlist_MetaBlocks" /> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_MetaBlocks" combine="interleave"> + <empty /> + </define> + <define name="blocks"> + <element name="blocks"> + <ref name="attlist_blocks" /> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_blocks" combine="interleave"> + <empty /> + </define> + <define name="Para"> + <element name="Para"> + <ref name="attlist_Para" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Para" combine="interleave"> + <empty /> + </define> + <define name="Plain"> + <element name="Plain"> + <ref name="attlist_Plain" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Plain" combine="interleave"> + <empty /> + </define> + <define name="Header"> + <element name="Header"> + <ref name="attlist_Header" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Header" combine="interleave"> + <optional> + <attribute name="level" a:defaultValue="1"> + <data type="positiveInteger" /> + </attribute> + </optional> + <ref name="attr" /> + </define> + <define name="Div"> + <element name="Div"> + <ref name="attlist_Div" /> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Div" combine="interleave"> + <ref name="attr" /> + </define> + <define name="BlockQuote"> + <element name="BlockQuote"> + <ref name="attlist_BlockQuote" /> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_BlockQuote" combine="interleave"> + <empty /> + </define> + <define name="HorizontalRule"> + <element name="HorizontalRule"> + <ref name="attlist_HorizontalRule" /> + <empty /> + </element> + </define> + <define name="attlist_HorizontalRule" combine="interleave"> + <empty /> + </define> + <define name="BulletList"> + <element name="BulletList"> + <ref name="attlist_BulletList" /> + <oneOrMore> + <ref name="item" /> + </oneOrMore> + </element> + </define> + <define name="attlist_BulletList" combine="interleave"> + <empty /> + </define> + <define name="OrderedList"> + <element name="OrderedList"> + <ref name="attlist_OrderedList" /> + <oneOrMore> + <ref name="item" /> + </oneOrMore> + </element> + </define> + <define name="attlist_OrderedList" combine="interleave"> + <optional> + <attribute name="start" a:defaultValue="1"> + <data type="positiveInteger" /> + </attribute> + </optional> + <optional> + <attribute name="number-style" a:defaultValue="DefaultStyle"> + <choice> + <value>DefaultStyle</value> + <value>Example</value> + <value>Decimal</value> + <value>LowerRoman</value> + <value>UpperRoman</value> + <value>LowerAlpha</value> + <value>UpperAlpha</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="number-delim" a:defaultValue="DefaultDelim"> + <choice> + <value>DefaultDelim</value> + <value>Period</value> + <value>OneParen</value> + <value>TwoParens</value> + </choice> + </attribute> + </optional> + </define> + <define name="DefinitionList"> + <element name="DefinitionList"> + <ref name="attlist_DefinitionList" /> + <oneOrMore> + <ref name="item" /> + </oneOrMore> + </element> + </define> + <define name="attlist_DefinitionList" combine="interleave"> + <empty /> + </define> + <define name="item"> + <element name="item"> + <ref name="attlist_item" /> + <choice> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + <group> + <ref name="term" /> + <oneOrMore> + <ref name="def" /> + </oneOrMore> + </group> + </choice> + </element> + </define> + <define name="attlist_item" combine="interleave"> + <empty /> + </define> + <define name="term"> + <element name="term"> + <ref name="attlist_term" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_term" combine="interleave"> + <empty /> + </define> + <define name="def"> + <element name="def"> + <ref name="attlist_def" /> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_def" combine="interleave"> + <empty /> + </define> + <define name="Table"> + <element name="Table"> + <ref name="attlist_Table" /> + <ref name="Caption" /> + <ref name="colspecs" /> + <ref name="TableHead" /> + <oneOrMore> + <ref name="TableBody" /> + </oneOrMore> + <ref name="TableFoot" /> + </element> + </define> + <define name="attlist_Table" combine="interleave"> + <ref name="attr" /> + </define> + <define name="Caption"> + <element name="Caption"> + <ref name="attlist_Caption" /> + <optional> + <ref name="ShortCaption" /> + </optional> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Caption" combine="interleave"> + <empty /> + </define> + <define name="ShortCaption"> + <element name="ShortCaption"> + <ref name="attlist_ShortCaption" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_ShortCaption" combine="interleave"> + <empty /> + </define> + <define name="colspecs"> + <element name="colspecs"> + <ref name="attlist_colspecs" /> + <oneOrMore> + <ref name="ColSpec" /> + </oneOrMore> + </element> + </define> + <define name="attlist_colspecs" combine="interleave"> + <empty /> + </define> + <define name="ColSpec"> + <element name="ColSpec"> + <ref name="attlist_ColSpec" /> + <empty /> + </element> + </define> + <define name="attlist_ColSpec" combine="interleave"> + <optional> + <attribute name="alignment" a:defaultValue="AlignDefault"> + <choice> + <value>AlignLeft</value> + <value>AlignRight</value> + <value>AlignCenter</value> + <value>AlignDefault</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="col-width" a:defaultValue="0"> + <data type="double"> + <param name="minInclusive">0</param> + <param name="maxInclusive">1</param> + </data> + </attribute> + </optional> + </define> + <define name="TableHead"> + <element name="TableHead"> + <ref name="attlist_TableHead" /> + <zeroOrMore> + <ref name="Row" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_TableHead" combine="interleave"> + <ref name="attr" /> + </define> + <define name="TableFoot"> + <element name="TableFoot"> + <ref name="attlist_TableFoot" /> + <zeroOrMore> + <ref name="Row" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_TableFoot" combine="interleave"> + <ref name="attr" /> + </define> + <define name="TableBody"> + <element name="TableBody"> + <ref name="attlist_TableBody" /> + <ref name="header" /> + <ref name="body" /> + </element> + </define> + <define name="attlist_TableBody" combine="interleave"> + <optional> + <attribute name="row-head-columns" a:defaultValue="0" /> + </optional> + <ref name="attr" /> + </define> + <define name="header"> + <element name="header"> + <ref name="attlist_header" /> + <zeroOrMore> + <ref name="Row" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_header" combine="interleave"> + <empty /> + </define> + <define name="body"> + <element name="body"> + <ref name="attlist_body" /> + <zeroOrMore> + <ref name="Row" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_body" combine="interleave"> + <empty /> + </define> + <define name="Row"> + <element name="Row"> + <ref name="attlist_Row" /> + <zeroOrMore> + <ref name="Cell" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Row" combine="interleave"> + <ref name="attr" /> + </define> + <define name="Cell"> + <element name="Cell"> + <ref name="attlist_Cell" /> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Cell" combine="interleave"> + <optional> + <attribute name="alignment" a:defaultValue="AlignDefault"> + <choice> + <value>AlignLeft</value> + <value>AlignRight</value> + <value>AlignCenter</value> + <value>AlignDefault</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="row-span" a:defaultValue="1"> + <data type="positiveInteger" /> + </attribute> + </optional> + <optional> + <attribute name="col-span" a:defaultValue="1"> + <data type="positiveInteger" /> + </attribute> + </optional> + <ref name="attr" /> + </define> + <define name="Figure"> + <element name="Figure"> + <ref name="attlist_Figure" /> + <ref name="Caption" /> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Figure" combine="interleave"> + <ref name="attr" /> + </define> + <define name="LineBlock"> + <element name="LineBlock"> + <ref name="attlist_LineBlock" /> + <oneOrMore> + <ref name="line" /> + </oneOrMore> + </element> + </define> + <define name="attlist_LineBlock" combine="interleave"> + <empty /> + </define> + <define name="line"> + <element name="line"> + <ref name="attlist_line" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_line" combine="interleave"> + <empty /> + </define> + <define name="CodeBlock"> + <element name="CodeBlock"> + <ref name="attlist_CodeBlock" /> + <text /> + </element> + </define> + <define name="attlist_CodeBlock" combine="interleave"> + <ref name="attr" /> + </define> + <define name="RawBlock"> + <element name="RawBlock"> + <ref name="attlist_RawBlock" /> + <text /> + </element> + </define> + <define name="attlist_RawBlock" combine="interleave"> + <attribute name="format" /> + </define> + <define name="Space"> + <element name="Space"> + <ref name="attlist_Space" /> + <empty /> + </element> + </define> + <define name="attlist_Space" combine="interleave"> + <optional> + <attribute name="count" a:defaultValue="1"> + <data type="positiveInteger" /> + </attribute> + </optional> + </define> + <define name="Str"> + <element name="Str"> + <ref name="attlist_Str" /> + <empty /> + </element> + </define> + <define name="attlist_Str" combine="interleave"> + <optional> + <attribute name="content" a:defaultValue="" /> + </optional> + </define> + <define name="Emph"> + <element name="Emph"> + <ref name="attlist_Emph" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Emph" combine="interleave"> + <empty /> + </define> + <define name="Strong"> + <element name="Strong"> + <ref name="attlist_Strong" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Strong" combine="interleave"> + <empty /> + </define> + <define name="Underline"> + <element name="Underline"> + <ref name="attlist_Underline" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Underline" combine="interleave"> + <empty /> + </define> + <define name="Strikeout"> + <element name="Strikeout"> + <ref name="attlist_Strikeout" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Strikeout" combine="interleave"> + <empty /> + </define> + <define name="Superscript"> + <element name="Superscript"> + <ref name="attlist_Superscript" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Superscript" combine="interleave"> + <empty /> + </define> + <define name="Subscript"> + <element name="Subscript"> + <ref name="attlist_Subscript" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Subscript" combine="interleave"> + <empty /> + </define> + <define name="SmallCaps"> + <element name="SmallCaps"> + <ref name="attlist_SmallCaps" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_SmallCaps" combine="interleave"> + <empty /> + </define> + <define name="Span"> + <element name="Span"> + <ref name="attlist_Span" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Span" combine="interleave"> + <ref name="attr" /> + </define> + <define name="Quoted"> + <element name="Quoted"> + <ref name="attlist_Quoted" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Quoted" combine="interleave"> + <optional> + <attribute name="quote-type" a:defaultValue="DoubleQuote"> + <choice> + <value>SingleQuote</value> + <value>DoubleQuote</value> + </choice> + </attribute> + </optional> + </define> + <define name="Math"> + <element name="Math"> + <ref name="attlist_Math" /> + <text /> + </element> + </define> + <define name="attlist_Math" combine="interleave"> + <optional> + <attribute name="math-type" a:defaultValue="InlineMath"> + <choice> + <value>DisplayMath</value> + <value>InlineMath</value> + </choice> + </attribute> + </optional> + </define> + <define name="RawInline"> + <element name="RawInline"> + <ref name="attlist_RawInline" /> + <text /> + </element> + </define> + <define name="attlist_RawInline" combine="interleave"> + <attribute name="format" /> + </define> + <define name="Cite"> + <element name="Cite"> + <ref name="attlist_Cite" /> + <zeroOrMore> + <choice> + <text /> + <ref name="citations" /> + <ref name="inline_element" /> + </choice> + </zeroOrMore> + </element> + </define> + <define name="attlist_Cite" combine="interleave"> + <empty /> + </define> + <define name="citations"> + <element name="citations"> + <ref name="attlist_citations" /> + <oneOrMore> + <ref name="Citation" /> + </oneOrMore> + </element> + </define> + <define name="attlist_citations" combine="interleave"> + <empty /> + </define> + <define name="Citation"> + <element name="Citation"> + <ref name="attlist_Citation" /> + <optional> + <ref name="prefix" /> + </optional> + <optional> + <ref name="suffix" /> + </optional> + </element> + </define> + <define name="prefix"> + <element name="prefix"> + <ref name="attlist_prefix" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_prefix" combine="interleave"> + <empty /> + </define> + <define name="suffix"> + <element name="suffix"> + <ref name="attlist_suffix" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_suffix" combine="interleave"> + <empty /> + </define> + <define name="attlist_Citation" combine="interleave"> + <optional> + <attribute name="id" /> + </optional> + <optional> + <attribute name="note-num" /> + </optional> + <optional> + <attribute name="hash" a:defaultValue="0" /> + </optional> + <optional> + <attribute name="mode" a:defaultValue="AuthorInText"> + <choice> + <value>AuthorInText</value> + <value>SuppressAuthor</value> + <value>NormalCitation</value> + </choice> + </attribute> + </optional> + </define> + <define name="Code"> + <element name="Code"> + <ref name="attlist_Code" /> + <text /> + </element> + </define> + <define name="attlist_Code" combine="interleave"> + <ref name="attr" /> + </define> + <define name="Image"> + <element name="Image"> + <ref name="attlist_Image" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Image" combine="interleave"> + <optional> + <attribute name="title"/> + </optional> + <optional> + <attribute name="src"/> + </optional> + <ref name="attr"/> + </define> + <define name="Link"> + <element name="Link"> + <ref name="attlist_Link" /> + <zeroOrMore> + <ref name="inline" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Link" combine="interleave"> + <optional> + <attribute name="title"/> + </optional> + <optional> + <attribute name="href"/> + </optional> + <ref name="attr"/> + </define> + <define name="SoftBreak"> + <element name="SoftBreak"> + <ref name="attlist_SoftBreak" /> + <empty /> + </element> + </define> + <define name="attlist_SoftBreak" combine="interleave"> + <empty /> + </define> + <define name="LineBreak"> + <element name="LineBreak"> + <ref name="attlist_LineBreak" /> + <empty /> + </element> + </define> + <define name="attlist_LineBreak" combine="interleave"> + <empty /> + </define> + <define name="Note"> + <element name="Note"> + <ref name="attlist_Note" /> + <zeroOrMore> + <ref name="block" /> + </zeroOrMore> + </element> + </define> + <define name="attlist_Note" combine="interleave"> + <empty /> + </define> + <start> + <choice> + <ref name="Pandoc" /> + </choice> + </start> +</grammar> diff --git a/tools/pandoc-xml.xsd b/tools/pandoc-xml.xsd new file mode 100644 index 000000000..01834f80f --- /dev/null +++ b/tools/pandoc-xml.xsd @@ -0,0 +1,602 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +A XML Schema definition for Pandoc XML format. +Copyright : Copyright (C) 2025- Massimiliano Farinella +License : GNU GPL, version 2 or above +Maintainer : Massimiliano Farinella <[email protected]> + +This is a XML Schema schema for the XML representation of Pandoc AST. +It's an equivalent of native and JSON formats, but modeled as XML. +You can use this schema to validate Pandoc XML documents. +It's translated from pandoc-xml.dtd with the "Trang" software by James Clark, +and adjusted manually to add some constraints: +- elements with Attr can have arbitrary attributes (this is not possible with a DTD) +- Header's "level", OrderedList's "start" and Cell's "rowspan" and "colspan" attributes + must be a positive integer and are equal to 1 if not specified +- column widths in ColSpec must be between 0 and 1 (inclusive, with 0=ColWidthDefault) +- the "count" attribute in the "<Space>" element must be a positive integer, + equal to 1 if not specified +- OrderedList's number style and delimiter, ColSpec's and Cell's alignment, + Quoted's QuoteType and Math's Mathtype + can only take the values specified in pandoc-types +- TableBody's row-head-columns must be zero (default, when not specified) or a positive integer +--> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + <xs:element name="Pandoc"> + <xs:complexType> + <xs:sequence> + <xs:element ref="meta"/> + <xs:element ref="blocks"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_Pandoc"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Pandoc"> + <xs:attribute name="api-version" use="required"/> + </xs:attributeGroup> + <xs:element name="block" abstract="true"/> + <xs:element name="inline_element" abstract="true"/> + <xs:group name="inline"> + <xs:sequence> + <xs:element minOccurs="0" ref="inline_element"/> + </xs:sequence> + </xs:group> + <xs:attributeGroup name="attr"> + <xs:attribute name="id" type="xs:ID"/> + <xs:attribute name="class"/> + <xs:anyAttribute processContents="skip"/> + </xs:attributeGroup> + <xs:element name="metavalue" abstract="true"/> + <xs:element name="meta"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="entry"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="MetaMap" substitutionGroup="metavalue"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="entry"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="entry"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="metavalue"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_entry"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_entry"> + <xs:attribute name="key" use="required"/> + </xs:attributeGroup> + <xs:element name="MetaList" substitutionGroup="metavalue"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="metavalue"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="MetaBool" substitutionGroup="metavalue"> + <xs:complexType> + <xs:attributeGroup ref="attlist_MetaBool"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_MetaBool"> + <xs:attribute name="value" use="required"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="true"/> + <xs:enumeration value="false"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:element name="MetaString" substitutionGroup="metavalue" type="xs:string"/> + <xs:element name="MetaInlines" substitutionGroup="metavalue"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="MetaBlocks" substitutionGroup="metavalue"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="blocks"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="Para" substitutionGroup="block"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="Plain" substitutionGroup="block"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="Header" substitutionGroup="block"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + <xs:attributeGroup ref="attlist_Header"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Header"> + <xs:attribute name="level" default="1" type="xs:positiveInteger"/> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="Div" substitutionGroup="block"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_Div"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Div"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="BlockQuote" substitutionGroup="block"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="HorizontalRule" substitutionGroup="block"> + <xs:complexType/> + </xs:element> + <xs:element name="BulletList" substitutionGroup="block"> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" ref="item"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="OrderedList" substitutionGroup="block"> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" ref="item"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_OrderedList"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_OrderedList"> + <xs:attribute name="start" default="1" type="xs:positiveInteger"/> + <xs:attribute name="number-style" default="DefaultStyle"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="DefaultStyle"/> + <xs:enumeration value="Example"/> + <xs:enumeration value="Decimal"/> + <xs:enumeration value="LowerRoman"/> + <xs:enumeration value="UpperRoman"/> + <xs:enumeration value="LowerAlpha"/> + <xs:enumeration value="UpperAlpha"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="number-delim" default="DefaultDelim"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="DefaultDelim"/> + <xs:enumeration value="Period"/> + <xs:enumeration value="OneParen"/> + <xs:enumeration value="TwoParens"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:element name="DefinitionList" substitutionGroup="block"> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" ref="item"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="item"> + <xs:complexType> + <xs:choice> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + <xs:sequence> + <xs:element ref="term"/> + <xs:element maxOccurs="unbounded" ref="def"/> + </xs:sequence> + </xs:choice> + </xs:complexType> + </xs:element> + <xs:element name="term"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="def"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="Table" substitutionGroup="block"> + <xs:complexType> + <xs:sequence> + <xs:element ref="Caption"/> + <xs:element ref="colspecs"/> + <xs:element ref="TableHead"/> + <xs:element maxOccurs="unbounded" ref="TableBody"/> + <xs:element ref="TableFoot"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_Table"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Table"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="Caption"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" ref="ShortCaption"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="ShortCaption"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="colspecs"> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" ref="ColSpec"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="ColSpec"> + <xs:complexType> + <xs:attributeGroup ref="attlist_ColSpec"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_ColSpec"> + <xs:attribute name="alignment" default="AlignDefault"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="AlignLeft"/> + <xs:enumeration value="AlignRight"/> + <xs:enumeration value="AlignCenter"/> + <xs:enumeration value="AlignDefault"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="col-width" default="0"> + <xs:simpleType> + <xs:restriction base="xs:double"> + <xs:minInclusive value="0"/> + <xs:maxInclusive value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:element name="TableHead"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="Row"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_TableHead"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_TableHead"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="TableFoot"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="Row"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_TableFoot"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_TableFoot"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="TableBody"> + <xs:complexType> + <xs:sequence> + <xs:element ref="header"/> + <xs:element ref="body"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_TableBody"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_TableBody"> + <xs:attribute name="row-head-columns" default="0"/> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="header"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="Row"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="body"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="Row"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="Row"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="Cell"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_Row"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Row"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="Cell"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_Cell"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Cell"> + <xs:attribute name="alignment" default="AlignDefault"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="AlignLeft"/> + <xs:enumeration value="AlignRight"/> + <xs:enumeration value="AlignCenter"/> + <xs:enumeration value="AlignDefault"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="row-span" default="1" type="xs:positiveInteger"/> + <xs:attribute name="col-span" default="1" type="xs:positiveInteger"/> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="Figure" substitutionGroup="block"> + <xs:complexType> + <xs:sequence> + <xs:element ref="Caption"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_Figure"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Figure"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="LineBlock" substitutionGroup="block"> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" ref="line"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="line"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="CodeBlock" substitutionGroup="block"> + <xs:complexType mixed="true"> + <xs:attributeGroup ref="attlist_CodeBlock"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_CodeBlock"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="RawBlock" substitutionGroup="block"> + <xs:complexType mixed="true"> + <xs:attributeGroup ref="attlist_RawBlock"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_RawBlock"> + <xs:attribute name="format" use="required"/> + </xs:attributeGroup> + <xs:element name="Space" substitutionGroup="inline_element"> + <xs:complexType> + <xs:attributeGroup ref="attlist_Space"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Space"> + <xs:attribute name="count" default="1" type="xs:positiveInteger"/> + </xs:attributeGroup> + <xs:element name="Str" substitutionGroup="inline_element"> + <xs:complexType> + <xs:attributeGroup ref="attlist_Str"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Str"> + <xs:attribute name="content" default=""/> + </xs:attributeGroup> + <xs:element name="Emph" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="Strong" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="Underline" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="Strikeout" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="Superscript" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="Subscript" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="SmallCaps" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="Span" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + <xs:attributeGroup ref="attlist_Span"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Span"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="Quoted" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + <xs:attributeGroup ref="attlist_Quoted"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Quoted"> + <xs:attribute name="quote-type" default="DoubleQuote"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="SingleQuote"/> + <xs:enumeration value="DoubleQuote"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:element name="Math" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:attributeGroup ref="attlist_Math"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Math"> + <xs:attribute name="math-type" default="InlineMath"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="DisplayMath"/> + <xs:enumeration value="InlineMath"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:element name="RawInline" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:attributeGroup ref="attlist_RawInline"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_RawInline"> + <xs:attribute name="format" use="required"/> + </xs:attributeGroup> + <xs:element name="Cite" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="citations"/> + <xs:element ref="inline_element"/> + </xs:choice> + </xs:complexType> + </xs:element> + <xs:element name="citations"> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" ref="Citation"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="Citation"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" ref="prefix"/> + <xs:element minOccurs="0" ref="suffix"/> + </xs:sequence> + <xs:attributeGroup ref="attlist_Citation"/> + </xs:complexType> + </xs:element> + <xs:element name="prefix"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:element name="suffix"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Citation"> + <xs:attribute name="id"/> + <xs:attribute name="note-num"/> + <xs:attribute name="hash" default="0"/> + <xs:attribute name="mode" default="AuthorInText"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="AuthorInText"/> + <xs:enumeration value="SuppressAuthor"/> + <xs:enumeration value="NormalCitation"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:element name="Code" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:attributeGroup ref="attlist_Code"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Code"> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="Image" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + <xs:attributeGroup ref="attlist_Image"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Image"> + <xs:attribute name="title"/> + <xs:attribute name="src"/> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="Link" substitutionGroup="inline_element"> + <xs:complexType mixed="true"> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/> + <xs:attributeGroup ref="attlist_Link"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist_Link"> + <xs:attribute name="title"/> + <xs:attribute name="href"/> + <xs:attributeGroup ref="attr"/> + </xs:attributeGroup> + <xs:element name="SoftBreak" substitutionGroup="inline_element"> + <xs:complexType/> + </xs:element> + <xs:element name="LineBreak" substitutionGroup="inline_element"> + <xs:complexType/> + </xs:element> + <xs:element name="Note" substitutionGroup="inline_element"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="block"/> + </xs:sequence> + </xs:complexType> + </xs:element> +</xs:schema> |
