Wikipedia.DTD

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

This is a first version of Wikipedia DTD. See also Wikipedia DTD/Examples.

<!--===========================================================================
This is a draft of Wikipedia DTD,
an interchangable XML representation of the content of Wikipedia articles.

Author: Jakob Voss
Date: 4-11-2003 (up to now no version number)

This DTD is published under the GNU Free Documentation License.

Missing parts:
- table, dl, pre, div, ruby, font, var
- many attributes of HTML-like-elements
============================================================================-->
<!ELEMENT article (meta, (text | redirect))>

<!ENTITY % possible-namespaces "(special | user | wikipedia | image)">

<!ENTITY % local-link-model " 
	talk (talk) #IMPLIED
	namespace %possible-namespaces; #IMPLIED
	article CDATA #REQUIRED
">

<!ELEMENT meta (title, status?, interwiki*, history?)>

<!ELEMENT title EMPTY>
<!ATTLIST title	
	interwiki NMTOKEN #IMPLIED
	%local-link-model;
>

<!ELEMENT interwiki EMPTY>
<!ATTLIST interwiki	
	language NMTOKEN #REQUIRED
	%local-link-model;
>

<!ELEMENT status EMPTY>
<!ATTLIST status
	protected (protected) #IMPLIED
	counter CDATA #IMPLIED
	notoc (notoc) #IMPLIED
>

<!ELEMENT history (edit)+>

<!ELEMENT edit (status?, interwiki*, (text | redirect)?)>
<!ATTLIST edit
	user CDATA #REQUIRED
	comment CDATA #IMPLIED
	timestamp CDATA #IMPLIED
	minor (minor) #IMPLIED
>

<!ELEMENT redirect EMPTY>
<!ATTLIST redirect	
	%local-link-model;
>


<!--== Wikitext ==-->

<!ENTITY % wikitext-block "ul | ol | center | blockquote | pbr | hr | h1 | h2 | h3 | h4 | h5 | h6">

<!ENTITY % wikitext-inline-format "b | i | sub | sup | big | small | tt | u | br | nowiki">
<!ENTITY % wikitext-inline-special "math | wikivar | link | reference | url | media">

<!ENTITY % wikitext-inline "%wikitext-inline-format; | %wikitext-inline-special;">

<!ELEMENT text (#PCDATA | %wikitext-block; | %wikitext-inline;)*>

<!--== Block elements == -->

<!ELEMENT h1 (#PCDATA | %wikitext-inline;)*>
<!ELEMENT h2 (#PCDATA | %wikitext-inline;)*>
<!ELEMENT h3 (#PCDATA | %wikitext-inline;)*>
<!ELEMENT h4 (#PCDATA | %wikitext-inline;)*>
<!ELEMENT h5 (#PCDATA | %wikitext-inline;)*>
<!ELEMENT h6 (#PCDATA | %wikitext-inline;)*>

<!ELEMENT hr EMPTY>

<!ELEMENT indent (#PCDATA | %wikitext-inline;)*>
<!ATTLIST indent
  depth CDATA '1'
>

<!ELEMENT ol (li | ol | uli)+>
<!ELEMENT ul (li | oli | uli)+>
<!ELEMENT oli (li | ol | uli)+>
<!ELEMENT uli (li | oli | uli)+>

<!ELEMENT li (#PCDATA | %wikitext-inline;)*>

<!ATTLIST blockquote
	cite CDATA #IMPLIED
>

<!ELEMENT center (#PCDATA | %wikitext-inline;)*>

<!ELEMENT blockquote (#PCDATA | %wikitext-inline;)*>

<!ELEMENT pbr EMPTY>

<!--== Inline elements == -->

<!ELEMENT nowiki (#PCDATA)>

<!ELEMENT link (#PCDATA | %wikitext-inline-format;)*>
<!ATTLIST link
	interwiki NMTOKEN #IMPLIED
	%local-link-model;
>

<!ELEMENT math (#PCDATA)>
<!ATTLIST math 
  image ENTITY #IMPLIED
>

<!ELEMENT url (#PCDATA | %wikitext-inline-format;)*>
<!ATTLIST url
  href CDATA #REQUIRED
>

<!ELEMENT reference EMPTY>
<!ATTLIST reference
   system (email | RFC | ISBN) #REQUIRED
   value CDATA #IMPLIED
>

<!ELEMENT media EMPTY>
<!ATTLIST media
	name CDATA #REQUIRED
  data ENTITY #IMPLIED
>

<!ELEMENT b (#PCDATA | i | big | small | sub | sup | tt | u | br | %wikitext-inline-special;)*>
<!ELEMENT i (#PCDATA | b | big | small | sub | sup | tt | u | br | %wikitext-inline-special;)*>

<!ELEMENT tt (#PCDATA | b | i | big | small | sub | sup | u | br | %wikitext-inline-special;)*>
<!ELEMENT u (#PCDATA | b | i | big | small | sub | sup | tt | br | %wikitext-inline-special;)*>
<!ELEMENT sub (#PCDATA | %wikitext-inline;)*>
<!ELEMENT sup (#PCDATA | %wikitext-inline;)*>
<!ELEMENT big (#PCDATA | %wikitext-inline;)*>
<!ELEMENT small (#PCDATA | %wikitext-inline;)*>
<!ELEMENT br EMPTY>

<!ELEMENT wikivar EMPTY>
<!ATTLIST wikivar
  name (CURRENTMONTH | CURRENTMONTHNAME | CURRENTDAY | CURRENTDAYNAME |
        CURRENTYEAR | CURRENTTIME | NUMBEROFARTICLES)
  #REQUIRED
>