mdvalidator Patch
Jonathan Pryor <[email protected]> Wed, 01 Nov 2006 18:24:02 -0500
| Newsgroups | gmane.comp.gnome.mono.documentation |
|---|---|
| Message-ID | <[email protected]> |
Just committed a patch to validate.exe. The ChangeLog: * Makefile.am: Add check, check-validate, check-validate-update targets. * monodoc-ecma.xsd: Update for ECMA-334 and ECMA-335 3rd edition (add <typeparam/>, <typeparamref/>, and other changes to better approximate the ECMA-335 DTD) and monodoc Generics support (TypeParameters, etc.). Also adds support for the index.xml and NamespaceName.xml files generated by monodocer, so it should be possible to do `mdvalidator ecma class/corlib/en` and not get overwhelmed with errors from these files. * validate.cs: Reduce output, so that no output is generated processing files that have no errors. * validate.check.monodocer, validate.check.monodocer.importslashdoc, validate.check.monodocer.since: Added; expected output when running against the ../tools/DocTest/en.expected* directories. Patch is attached. - Jon _______________________________________________ Mono-docs-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-docs-list
validate.patch
(text/x-patch, 21.3 KB)
Index: engine/validate.check.monodocer
===================================================================
--- engine/validate.check.monodocer (revision 0)
+++ engine/validate.check.monodocer (revision 0)
@@ -0,0 +1 @@
+Total validation errors: 0
Index: engine/validate.check.monodocer.since
===================================================================
--- engine/validate.check.monodocer.since (revision 0)
+++ engine/validate.check.monodocer.since (revision 0)
@@ -0,0 +1 @@
+Total validation errors: 0
Index: engine/monodoc-ecma.xsd
===================================================================
--- engine/monodoc-ecma.xsd (revision 67248)
+++ engine/monodoc-ecma.xsd (working copy)
@@ -22,6 +22,7 @@
<xs:attribute name="Language" type="xs:string" />
<xs:attribute name="lang" type="xs:string" />
<xs:attribute name="langword" type="xs:string" />
+ <xs:attribute name="Library" type="xs:string" />
<xs:attribute name="location" type="xs:string" />
<xs:attribute name="Maintainer" type="xs:string" />
<xs:attribute name="MemberName" type="xs:string" />
@@ -35,8 +36,10 @@
<xs:attribute name="source" type="xs:string" />
<xs:attribute name="subset" type="xs:string" />
<xs:attribute name="Value" type="xs:string" />
+ <xs:attribute name="version" type="xs:string" />
<xs:attribute name="type" type="xs:string" />
<xs:attribute name="Type" type="xs:string" />
+ <xs:attribute name="TypeParamName" type="xs:string" />
<!-- define simple elements -->
<xs:element name="AssemblyName" type="xs:string" />
@@ -46,9 +49,11 @@
<xs:element name="AttributeName" type="xs:string" />
<xs:element name="BaseTypeName" type="xs:string" />
<xs:element name="Excluded" type="xs:string" />
+ <xs:element name="ExcludedBaseTypeName" type="xs:string" />
<xs:element name="ExcludedLibrary" type="xs:string" />
<xs:element name="ExcludedLibraryName" type="xs:string" />
<xs:element name="ExcludedTypeName" type="xs:string" />
+ <xs:element name="i" type="xs:string" />
<xs:element name="InterfaceName" type="xs:string" />
<xs:element name="li" type="xs:string" />
<xs:element name="MemberOfLibrary" type="xs:string" />
@@ -56,11 +61,16 @@
<xs:element name="MemberValue" type="xs:string" />
<xs:element name="onequarter" type="xs:string" />
<xs:element name="ReturnType" type="xs:string" />
- <xs:element name="sub" type="xs:string" />
- <xs:element name="sup" type="xs:string" />
<xs:element name="TypeExcluded" type="xs:string" />
+ <xs:element name="TypeParameter" type="xs:string" />
<!-- define complex elements -->
+ <xs:element name="altcompliant">
+ <xs:complexType>
+ <xs:attribute ref="cref" />
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="altmember">
<xs:complexType>
<xs:simpleContent>
@@ -106,17 +116,40 @@
<xs:complexType>
<xs:sequence>
<xs:element ref="BaseTypeName" minOccurs="0" />
+ <xs:element ref="BaseTypeArguments" minOccurs="0" />
+ <xs:element ref="ExcludedBaseTypeName" minOccurs="0" />
+ <xs:element ref="ExcludedLibraryName" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
+ <xs:element name="BaseTypeArgument">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="TypeParamName" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="BaseTypeArguments">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="BaseTypeArgument" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="block">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block" />
+ <xs:element ref="c" />
+ <xs:element ref="code" />
+ <xs:element ref="list" />
<xs:element ref="para" />
<xs:element ref="paramref" />
<xs:element ref="see" />
- <xs:element ref="list" />
+ <xs:element ref="subscript" />
+ <xs:element ref="sup" />
+ <xs:element ref="typeparamref" />
</xs:choice>
<xs:attribute ref="subset" />
<xs:attribute ref="type" />
@@ -126,7 +159,11 @@
<xs:element name="c">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="code" />
<xs:element ref="para" />
+ <xs:element ref="paramref" />
+ <xs:element ref="see" />
+ <xs:element ref="typeparamref" />
</xs:choice>
</xs:complexType>
</xs:element>
@@ -186,9 +223,14 @@
<xs:element name="description">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="see" />
+ <xs:element ref="c" />
+ <xs:element ref="block" />
<xs:element ref="paramref" />
<xs:element ref="para" />
+ <xs:element ref="SPAN" />
+ <xs:element ref="see" />
+ <xs:element ref="sub" />
+ <xs:element ref="typeparamref" />
</xs:choice>
</xs:complexType>
</xs:element>
@@ -205,6 +247,10 @@
<xs:element ref="value" />
<xs:element ref="permission" />
<xs:element ref="altmember" />
+ <xs:element ref="altcompliant" />
+ <xs:element ref="since" />
+ <xs:element ref="threadsafe" />
+ <xs:element ref="typeparam" />
</xs:choice>
</xs:complexType>
</xs:element>
@@ -228,11 +274,13 @@
</xs:element>
<xs:element name="example">
- <xs:complexType>
+ <xs:complexType mixed="true">
<xs:choice maxOccurs="unbounded">
<xs:element ref="para" />
<xs:element ref="code" />
<xs:element ref="c" />
+ <xs:element ref="list" />
+ <xs:element ref="see" />
</xs:choice>
</xs:complexType>
</xs:element>
@@ -240,9 +288,12 @@
<xs:element name="exception">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block" />
<xs:element ref="para" />
<xs:element ref="paramref" />
<xs:element ref="see" />
+ <xs:element ref="SPAN" />
+ <xs:element ref="typeparamref" />
</xs:choice>
<xs:attribute ref="cref" />
</xs:complexType>
@@ -295,6 +346,14 @@
</xs:complexType>
</xs:element>
+ <xs:element name="Libraries">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="Type" minOccurs = "1" maxOccurs="unbounded" />
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="link">
<xs:complexType>
<xs:simpleContent>
@@ -347,7 +406,7 @@
<xs:element name="Member">
<xs:complexType>
<xs:sequence>
- <xs:element ref="MemberSignature" maxOccurs="2" />
+ <xs:element ref="MemberSignature" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="MemberType" maxOccurs="1" />
<xs:element ref="Attributes" minOccurs="0" maxOccurs="1" />
<xs:element ref="ReturnValue" minOccurs="0" maxOccurs="1" />
@@ -355,7 +414,7 @@
<xs:element ref="MemberValue" minOccurs="0" maxOccurs="1" />
<xs:element ref="Docs" maxOccurs="1" />
<xs:element ref="Excluded" minOccurs="0" maxOccurs="1" />
- <xs:element ref="ExcludedLibrary" minOccurs="0" maxOccurs="5" />
+ <xs:element ref="ExcludedLibrary" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute ref="MemberName" />
<xs:attribute ref="Deprecated" />
@@ -412,6 +471,8 @@
<xs:element ref="onequarter" />
<xs:element ref="sub" />
<xs:element ref="sup" />
+ <xs:element ref="SPAN" />
+ <xs:element ref="typeparamref" />
</xs:choice>
</xs:complexType>
</xs:element>
@@ -419,10 +480,13 @@
<xs:element name="param">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="c" />
<xs:element ref="see" />
<xs:element ref="block" />
<xs:element ref="paramref" />
<xs:element ref="para" />
+ <xs:element ref="SPAN" />
+ <xs:element ref="typeparamref" />
</xs:choice>
<xs:attribute ref="name" use="required" />
</xs:complexType>
@@ -456,7 +520,11 @@
<xs:element name="permission">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block" />
+ <xs:element ref="para" />
+ <xs:element ref="paramref" />
<xs:element ref="see" />
+ <xs:element ref="typeparamref" />
</xs:choice>
<xs:attribute ref="cref" />
</xs:complexType>
@@ -474,6 +542,7 @@
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="block" />
+ <xs:element ref="c" />
<xs:element ref="code" />
<xs:element ref="para" />
<xs:element ref="paramref" />
@@ -481,6 +550,8 @@
<xs:element ref="ul" />
<xs:element ref="example" />
<xs:element ref="list" />
+ <xs:element ref="SPAN" />
+ <xs:element ref="typeparamref" />
</xs:choice>
</xs:complexType>
</xs:element>
@@ -492,6 +563,7 @@
<xs:element ref="para" />
<xs:element ref="paramref" />
<xs:element ref="see" />
+ <xs:element ref="typeparamref" />
<xs:element ref="ul" />
</xs:choice>
</xs:complexType>
@@ -513,6 +585,26 @@
</xs:complexType>
</xs:element>
+ <xs:element name="since">
+ <xs:complexType>
+ <xs:attribute ref="version" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="SPAN">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block" />
+ <xs:element ref="para" />
+ <xs:element ref="paramref" />
+ <xs:element ref="see" />
+ <xs:element ref="SPAN" />
+ <xs:element ref="typeparamref" />
+ </xs:choice>
+ <xs:attribute ref="version" />
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="struct">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
@@ -529,6 +621,21 @@
</xs:complexType>
</xs:element>
+ <xs:element name="sub">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="paramref" />
+ <xs:element ref="typeparamref" />
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="subscript">
+ <xs:complexType mixed="true">
+ <xs:attribute name="term" type="xs:string" use="required" />
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="summary">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
@@ -536,23 +643,44 @@
<xs:element ref="para" />
<xs:element ref="paramref" />
<xs:element ref="see" />
+ <xs:element ref="typeparamref" />
<xs:element ref="ul" />
<xs:element ref="list" />
</xs:choice>
</xs:complexType>
</xs:element>
+ <xs:element name="sup">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="paramref" />
+ <xs:element ref="typeparamref" />
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="term">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block" />
+ <xs:element ref="c" />
<xs:element ref="see" />
<xs:element ref="para" />
- <xs:element ref="param" />
<xs:element ref="paramref" />
+ <xs:element ref="sup" />
+ <xs:element ref="typeparamref" />
</xs:choice>
</xs:complexType>
</xs:element>
+ <xs:element name="threadsafe">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="para" minOccurs="1" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="ThreadingSafetyStatement">
<xs:complexType mixed="true">
<xs:sequence>
@@ -575,6 +703,7 @@
<xs:element ref="TypeSignature" minOccurs="1" />
<xs:element ref="MemberOfLibrary" minOccurs="0" />
<xs:element ref="AssemblyInfo" minOccurs="1" />
+ <xs:element ref="TypeParameters" minOccurs="1" />
<xs:element ref="ThreadingSafetyStatement" minOccurs="0" />
<xs:element ref="ThreadSafetyStatement" minOccurs="0" />
<xs:element ref="Docs" minOccurs="1" />
@@ -593,6 +722,43 @@
</xs:complexType>
</xs:element>
+ <xs:element name="Types">
+ <xs:complexType>
+ <xs:choice minOccurs="1" maxOccurs="unbounded">
+ <xs:element ref="Type" />
+ </xs:choice>
+ <xs:attribute ref="Library" use="required" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="typeparam">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block" />
+ <xs:element ref="c" />
+ <xs:element ref="para" />
+ <xs:element ref="paramref" />
+ <xs:element ref="see" />
+ <xs:element ref="typeparamref" />
+ </xs:choice>
+ <xs:attribute ref="name" use="required" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="typeparamref">
+ <xs:complexType>
+ <xs:attribute ref="name" use="required" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="TypeParameters">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="TypeParameter" />
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="TypeSignature">
<xs:complexType>
<xs:attribute ref="Language" use="required" />
@@ -613,9 +779,11 @@
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="block" />
+ <xs:element ref="c" />
<xs:element ref="para" />
<xs:element ref="paramref" />
<xs:element ref="see" />
+ <xs:element ref="typeparamref" />
<xs:element ref="ul" />
<xs:element ref="example" />
<xs:element ref="list" />
@@ -623,5 +791,97 @@
</xs:complexType>
</xs:element>
+ <!--
+ index.xml & namespace-name.xml support
+ -->
+
+ <!-- define attributes -->
+ <xs:attribute name="Version" type="xs:string" />
+ <xs:attribute name="DisplayName" type="xs:string" />
+
+ <!-- define simple elements -->
+ <xs:element name="Title" type="xs:string" />
+
+ <!-- define complex elements -->
+ <xs:element name="Assemblies">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="Assembly" />
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="Assembly">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="Attributes" />
+ </xs:choice>
+ <xs:attribute ref="Name" />
+ <xs:attribute ref="Version" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="Copyright">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block" />
+ <xs:element ref="code" />
+ <xs:element ref="example" />
+ <xs:element ref="list" />
+ <xs:element ref="para" />
+ <xs:element ref="paramref" />
+ <xs:element ref="see" />
+ <xs:element ref="typeparamref" />
+ <xs:element ref="ul" />
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="Overview">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="Assemblies" />
+ <xs:element ref="Copyright" />
+ <xs:element ref="Remarks" />
+ <xs:element ref="Title" />
+ <xs:element name="Types">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="Namespace">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="Type">
+ <xs:complexType>
+ <xs:attribute ref="Name" use="required" />
+ <xs:attribute ref="DisplayName" />
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ <xs:attribute ref="Name" />
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="Remarks">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block" />
+ <xs:element ref="code" />
+ <xs:element ref="example" />
+ <xs:element ref="list" />
+ <xs:element ref="para" />
+ <xs:element ref="paramref" />
+ <xs:element ref="typeparamref" />
+ <xs:element ref="see" />
+ <xs:element ref="ul" />
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
</xs:schema>
Index: engine/validate.check.monodocer.importslashdoc
===================================================================
--- engine/validate.check.monodocer.importslashdoc (revision 0)
+++ engine/validate.check.monodocer.importslashdoc (revision 0)
@@ -0,0 +1,5 @@
+XmlSchema error: Invalid start element: :extra XML URI: file:///area-51/Projects/mono-HEAD/monodoc/tools/DocTest/en.expected.importslashdoc/Mono.DocTest/Widget.xml . Line 418, Position 6.
+XmlSchema error: Element declaration for extra is missing. XML URI: file:///area-51/Projects/mono-HEAD/monodoc/tools/DocTest/en.expected.importslashdoc/Mono.DocTest/Widget.xml . Line 418, Position 6.
+XmlSchema error: Invalid start element: :altmember XML URI: file:///area-51/Projects/mono-HEAD/monodoc/tools/DocTest/en.expected.importslashdoc/Mono.DocTest/Widget.xml . Line 419, Position 6.
+XmlSchema error: Invalid end element: Docs XML URI: file:///area-51/Projects/mono-HEAD/monodoc/tools/DocTest/en.expected.importslashdoc/Mono.DocTest/Widget.xml . Line 420, Position 5.
+Total validation errors: 4
Index: engine/ChangeLog
===================================================================
--- engine/ChangeLog (revision 67248)
+++ engine/ChangeLog (working copy)
@@ -1,3 +1,19 @@
+2006-11-01 Jonathan Pryor <[email protected]>
+
+ * Makefile.am: Add check, check-validate, check-validate-update targets.
+ * monodoc-ecma.xsd: Update for ECMA-334 and ECMA-335 3rd edition (add
+ <typeparam/>, <typeparamref/>, and other changes to better approximate the
+ ECMA-335 DTD) and monodoc Generics support (TypeParameters, etc.).
+ Also adds support for the index.xml and NamespaceName.xml files generated
+ by monodocer, so it should be possible to do
+ `mdvalidator ecma class/corlib/en` and not get overwhelmed with errors
+ from these files.
+ * validate.cs: Reduce output, so that no output is generated processing
+ files that have no errors.
+ * validate.check.monodocer, validate.check.monodocer.importslashdoc,
+ validate.check.monodocer.since: Added; expected output when running
+ against the ../tools/DocTest/en.expected* directories.
+
2006-10-30 Miguel de Icaza <[email protected]>
* provider.cs: Do not call chmod on non-Unix.
Index: engine/validate.cs
===================================================================
--- engine/validate.cs (revision 67248)
+++ engine/validate.cs (working copy)
@@ -63,18 +63,19 @@
static void ValidateFile (string file)
{
IsValid = true;
- Console.WriteLine ("Checking {0}", file);
- reader = new XmlValidatingReader (new XmlTextReader (file));
- reader.ValidationType = ValidationType.Schema;
- reader.Schemas.Add (schema);
- reader.ValidationEventHandler += new ValidationEventHandler (OnValidationEvent);
- while (reader.Read ()) {
- // do nothing
+ try {
+ reader = new XmlValidatingReader (new XmlTextReader (file));
+ reader.ValidationType = ValidationType.Schema;
+ reader.Schemas.Add (schema);
+ reader.ValidationEventHandler += new ValidationEventHandler (OnValidationEvent);
+ while (reader.Read ()) {
+ // do nothing
+ }
+ reader.Close ();
}
- reader.Close ();
-
- if (IsValid)
- Console.WriteLine ("{0} is valid.", file);
+ catch (Exception e) {
+ Console.WriteLine ("mdvalidator: error: " + e.ToString ());
+ }
}
static void RecurseDirectory (string dir)
Index: engine/Makefile.am
===================================================================
--- engine/Makefile.am (revision 67248)
+++ engine/Makefile.am (working copy)
@@ -140,3 +140,20 @@
uninstall-local:
-$(GACUTIL) /u monodoc /package monodoc /gacdir $(GACDIR) /root $(GACROOT)
+
+check-validate-update: validate.exe
+ mono validate.exe ecma ../tools/DocTest/en.expected > validate.check.monodocer
+ mono validate.exe ecma ../tools/DocTest/en.expected.importslashdoc > \
+ validate.check.monodocer.importslashdoc
+ mono validate.exe ecma ../tools/DocTest/en.expected.since > \
+ validate.check.monodocer.since
+
+check-validate: validate.exe
+ mono validate.exe ecma ../tools/DocTest/en.expected | diff - validate.check.monodocer
+ mono validate.exe ecma ../tools/DocTest/en.expected.importslashdoc | \
+ diff --brief - validate.check.monodocer.importslashdoc
+ mono validate.exe ecma ../tools/DocTest/en.expected.since | \
+ diff --brief - validate.check.monodocer.since
+
+check: check-validate
+