mdoc(5) File Formats Manual mdoc(5) NAME mdoc - Mono Documentation XML Format DESCRIPTION The assorted Mono documentation programs generate or manipulate XML files following the mono documentation schema: mdoc update Creates or updates mono documentation XML for a set of assemblies. mdoc validate Validates the mono documentation XML against the mono documentation XML schema. mdoc assemble Converts the mono documentation XML within a directory structure into a set of files for use with monodoc(1). mdoc export-html Converts the mono documentation XML within a directory structure into a set of HTML files that can be viewed with a web browser. All of these tools (and more) use the common XML schema described in this man page. FILE/DIRECTORY STRUCTURE There are three sets of Mono documentation XML files: * index.xml: contains a list of all assemblies within the containing directory, and all types and namespaces within those assemblies. * ns-*.xml: There is one ns-*.xml file for each namespace within the assembly; these files are siblings to index.xml . Examples of ns-*.xml files include: ns-System.xml, ns- System.Collections.xml, and ns-.xml (for the root namespace, though it is recommended to NOT place types into the root namespace, as monodoc(1) doesn't display them). The ns-*.xml files contain per-namespace documentation. * NamespaceName/TypeName.xml: These files are within a dotted NamespaceName directory, and TypeName is the name of the type. Examples include: RootType.xml (if the type has no namespace), System/String.xml, System.Collections/IEnumerable.xml, and System.Collections.Generic/List`1+Enumerator.xml (the `1 is the number of generic type parameters the type accepts, and everything after the + is a nested type). Thus, typical directory contents would resemble: index.xml ns-System.xml ns-System.Collections.Generic.xml System/String.xml System.Collections.Generic/List`1.xml DOCUMENTATION FORMAT index.xml File Format The index.xml file contains a list of the assemblies nested under the directory containing index.xml and all namespaces and types within those assemblies. It looks something like this: To be added. To be added. DocTest Most of this is maintained automatically, in particular the /Overview/Assemblies and /Overview/Types elements. The //Namespace/@Name attribute corresponds to a directory which contains files named //Type/@Name.xml, while the //Type/@DisplayName attribute contains a C# type name (if //Type/@DisplayName isn't found, then //Type/@Name is used as the display name). There should also be a ns-[//Namespace/@Name].xml file. There are three elements of interest to authors: /Overview/Remarks, /Overview/Copyright, and /Overview/Title, which contain assembly-level documentation. These elements can contain any of the following XML elements (documented in the Documentation XML Elements section): block, code, example, list, para, paramref, typeparamref, see, and ul. ns-*.xml File Format The ns-*.xml files contain namespace documentation: To be added. To be added. The /Namespace/Docs/summary and /Namespace/Docs/remarks elements should contain namespace documentation. The remarks and summary elements are documented in the Documentation XML Elements section. NamespaceName/TypeName.xml File Format The mono documentation format is similar to the Ecma documentation format, as described in ECMA-335 3rd Edition, Partition IV, Chapter 7. The principal difference from the ECMA format is that each type gets its own file, within a directory identical to the namespace of the type. There is a lot of information that is maintained automatically by mdoc(1); Most of the information within the documentation should not be edited. This includes the type name (/Type/@FullName), implemented interfaces (/Type/Interfaces), member information (/Type/Members/Member/@MemberName, /Type/Members/Member/MemberSignature, /Type/Members/Member/MemberType, /Type/Members/Member/Parameters, etc.). DocTest 0.0.0.0 System.Attribute System.AttributeUsage(System.AttributeTargets.All) To be added. To be added. Constructor 0.0.0.0 To be added. To be added. To be added. The only elements that normally need to be edited are children of the //Docs elements, which usually contain the text To be added. The /Type/Docs element contains type-level documentation, while the /Type/Members/Member/Docs element contains per-member documentation. The //Docs elements can contain the following elements: altcompliant, altmember, example, exception, param, permission, remarks, returns, since, summary, threadsafe, typeparam, and value. Nested types are not members; they are types, and are documented in their own file. Consequently, the NamespaceName/TypeName.xml files are not recursive; you do not store a element within a element. Documentation XML Elements The contents of the Docs element is identical in semantics and structure to the inline C# documentation format, consisting of these elements (listed in ECMA-334 3rd Edition, Annex E, Section 2). The following are used within the element descriptions: CREF Refers to a class (or member) reference, and is a string in the format described below in the CREF FORMAT section. TEXT Non-XML text, and XML should not be nested. XML Only XML elements should be nested (which indirectly may contain text), but non-whitespace text should not be an immediate child node. XML_TEXT Free-form text and XML, so that other XML elements may be nested. The following elements are used in documentation: is a top-level element, and should be nested directly under the element. Allows an entry to be generated for the See Also section. Use to specify a link from within text. XML_TEXT Create a block of text, similar in concept to a paragraph, but is used to create divisions within the text. To some extent, a is equivalent to the HTML

tag. SUBSET should always be the value "none". TYPE specifies the heading and formatting to use. Recognized types are: behaviors Creates a section with the heading Operation. note Creates a section with the heading Note:. overrides Creates a section with the heading Note to Inheritors. usage Creates a section with the heading Usage. The block element can contain the following elements: block, c, code, list, para, paramref, see, subscript, sup, and typeparamref. XML_TEXT Set text in a code-like font (similar to the HTML element). The c element can contain the following elements: code, para, paramref, see, and typeparamref. TEXT Display multiple lines of text in a code-like font (similar to the HTML
 element).

              LANGUAGE is the language this code block is for.  For example,
              if LANGUAGE is C#, then TEXT will get syntax highlighting for
              the C# language within the Mono Documentation Browser.

              SOURCE is only interpreted by mdoc-update(1).  If the src
              attribute is present when mdoc-update(1) is run, then SOURCE is
              a file (relative to mdoc-update(1)'s --out directory) that
              should be inserted as the value for TEXT.  The contents of TEXT
              will be ignored by mdoc-update(1) and replaced on every
              invocation.  SOURCE can also contain an "anchor", e.g.
              src="path/to/file.cs#RegionMarker".  If an anchor is present,
              and LANGUAGE is C#, then #region RegionMarker will be searched
              for, and the contents between the #region and the following
              #endregion will be inserted as the value for TEXT element.

       XML_TEXT
              Indicates an example that should be displayed specially.  For
              example:

                  
                    An introductory paragraph.
                    
                      class Example {
                        public static void Main ()
                        {
                          System.Console.WriteLine ("Hello, World!");
                        }
                      }
                    
                  

              The example element can contain the following elements: c, code,
              list, para, and see.

       XML_TEXT
              Identifies an exception that can be thrown by the documented
              member.

               is a top-level element, and should be nested
              directly under the  element.

              CREF is the exception type that is thrown, while XML_TEXT
              contains the circumstances that would cause CREF to be thrown.

                  
                     was .
                  

              The exception element can contain the following elements: block,
              para, paramref, see, and typeparamref.

       XML_TEXT
              The  element is an "escape hatch," for including
              (possibly XML) content that is not valid mdoc(5) content.  It's
              the moral equivalent of perlpod(1) =begin format blocks.

              TYPE is the mime type of XML_TEXT.  mdoc(5) processors may skip
              format/> blocks of they use a type that isn't supported.

              For example:

                  
                    
Hello, world!
would cause the embedded HTML element to be inserted inline into the resulting HTML document when mdoc-export-html(1) processes the file. (Likewise, it may be skipped if processed by another program.) format/> is intended to simplify importing documentation from existing documentation sources. It should not be relied upon, if at all possible. XML Create a list or table of items. makes use of nested XML, XML, XML_TEXT, and XML_TEXT elements. Lists have the syntax: Bullet 1 Bullet 2 Bullet 3 Tables have the syntax: Column 1 Column 2 Column 3 Item 1-A Item 1-B Item 1-C Item 2-A Item 2-B Item 2-C The item and description elements can each contain text and the following elements: block, c, para, paramref, see, sup, and typeparamref. XML_TEXT Insert a paragraph of XML_TEXT. For example, This is a paragraph of text. The para element can contain the following elements: block, c, example, link, list, onequarter, paramref, see, sub, sup, typeparamref, and ul. XML_TEXT is a top-level element, and should be nested directly under the element. Describes the parameter NAME of the current constructor, method, or property: A containing the number of widgets to process. The param element can contain the following elements: block, c, example, para, paramref, see, and typeparamref. Indicates that NAME is a parameter. This usually renders NAME as italic text, so it is frequently (ab)used as an equivalent to the HTML element. See the documentation (above) for an example. XML_TEXT Documents the security accessibility requirements of the current member. is a top-level element, and should be nested directly under the element. CREF is a type reference to the security permission required, while XML_TEXT is a description of why the permission is required. Requires permission for reading and writing files. See , . The permission element can contain the following elements: block, para, paramref, see, and typeparamref. XML_TEXT Contains detailed information about a member. is a top-level element, and should be nested directly under the element. Insert detailed information here. The remarks element can contain the following elements: block, c, code, example, list, para, paramref, see, and typeparamref. XML_TEXT is a top-level element, and should be nested directly under the element. Describes the return value of a method: A specifying whether or not the process can access . The returns element can contain the following elements: c, format, list, para, paramref, see, and typeparamref. , Creates a link to the specified member within the current text: or specifies that LANGWORD is a language keyword: Do not use seealso, use altmember. is a top-level element, and should be nested directly under the element. Permits specification of which version introduced the specified type or member. This generally isn't required, as the //AssemblyInfo/AssemblyVersion elements track which assembly versions contain type or member. XML_TEXT is a top-level element, and should be nested directly under the element. Provides a (brief!) overview about a type or type member. This is usually displayed as part of a class declaration, and should be a reasonably short description of the type/member. Use for more detailed information. The summary element can contain the following elements: block, list, para, paramref, see, and typeparamref. XML_TEXT is a top-level element, and should be nested directly under the element. This is used to document a type parameter for a generic type or generic method. NAME is the name of the type parameter, while XML_TEXT contains a description of the parameter (what it's used for, what restrictions it must meet, etc.). The type of the underlying collection The typeparam element can contain the following elements: block, c, para, paramref, see, and typeparamref. Used to indicate that NAME is a type parameter. XML_TEXT is a top-level element, and should be nested directly under the element. Allows a property to be described. A containing a widget name. The value element can contain the following elements: block, c, example, list, para, paramref, see, and typeparamref. CREF FORMAT String IDs (CREFs) are used to refer to a type or member of a type. String IDs are documented in ECMA-334 3rd Edition, Annex E.3.1. They consist of a member type prefix, the full type name (namespace + name, separated by .), possibly followed by the member name and other information. Member type prefixes: C: The CREF refers to a constructor. The (optional) parameter list is enclosed in parenthesis and follows the type name: C:System.String(System.Char,System.Int32). E: The CREF refers to an event. The event name follows the type name: E:System.AppDomain.AssemblyLoad. F: The CREF refers to a field. The field name follows the type name: F:System.Runtime.InteropServices.DllImportAttribute.SetLastError. M: Refers to a constructor or method. Constructors may append .ctor to the type name (instead of using the above C: constructor format), while methods append the method name and an (optional) count of the number of generic parameters. Both constructors and methods may append the method parameter list enclosed in parenthesis. Examples: M:System.Object..ctor, M:System.String..ctor(System.Char[]), M:System.String.Concat(System.Object), M:System.Array.Sort``1(``0[]), M:System.Collections.Generic.List`1..ctor, M:System.Collections.Generic.List`1.Add(`0). N: Refers to a namespace, e.g. N:System. P: Refers to a property. If the property is an indexer or takes parameters, the parameter types are appended to the property name and enclosed with parenthesis: P:System.String.Length, P:System.String.Chars(System.Int32). T: The CREF refers to a type, with the number of generic types appended: T:System.String, T:System.Collections.Generic.List`1, T:System.Collections.Generic.List`1.Enumerator. To make matters more interesting, generic types & members have two representations: the "unbound" representation (shown in examples above), in which class names have the count of generic parameters appended to their name. There is also a "bound" representation, in which the binding of generic parameters is listed within '{' and '}' or '<' and '>'. (Use of '<' and '>' is less common, as within an XML document their escaped character entities must instead be used, leading to '<' and '>'.) Unbound: * T:System.Collections.Generic.List`1 * T:System.Collections.Generic.Dictionary`2 Bound: * T:System.Collections.Generic.List{System.Int32} * T:System.Collections.Generic.List * T:System.Collections.Generic.List<System.Int32> * T:System.Predicate{System.Action{System.String}} As you can see, bound variants can be arbitrarily complex (just like generics). Furthermore, if a generic parameter is bound to the generic parameter of a type or method, the "index" of the type/method's generic parameter is used as the binding, so given class FooType { public static void Foo (System.Predicate predicate) { } } The CREF for this method is M:FooType.Foo``1(System.Predicate{``0}), ``0 is the 0th generic parameter index which is bound to System.Predicate. SEE ALSO mdoc(1), monodocer(1) MAILING LISTS Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details. WEB SITE Visit http://www.mono-project.com for details mdoc(5)