Author: atsushi
Date: 2005-03-07 01:27:13 -0500 (Mon, 07 Mar 2005)
New Revision: 41503
Modified:
trunk/mcs/class/Commons.Xml.Relaxng/ChangeLog
trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Nvdl/ChangeLog
trunk/mcs/class/Commons.Xml.Relaxng/README
Log:
oops, README was not there, but in the top dir.
Modified: trunk/mcs/class/Commons.Xml.Relaxng/ChangeLog
===================================================================
--- trunk/mcs/class/Commons.Xml.Relaxng/ChangeLog 2005-03-07 06:03:04 UTC
(rev 41502)
+++ trunk/mcs/class/Commons.Xml.Relaxng/ChangeLog 2005-03-07 06:27:13 UTC
(rev 41503)
@@ -1,3 +1,8 @@
+2005-03-07 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * README :
+ more description.
+
2005-03-06 Atsushi Enomoto <[EMAIL PROTECTED]>
* Commons.Xml.Relaxng.dll.sources : added NvdlFilteredXmlReader.
Modified: trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Nvdl/ChangeLog
===================================================================
--- trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Nvdl/ChangeLog
2005-03-07 06:03:04 UTC (rev 41502)
+++ trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Nvdl/ChangeLog
2005-03-07 06:27:13 UTC (rev 41503)
@@ -1,7 +1,5 @@
2005-03-07 Atsushi Enomoto <[EMAIL PROTECTED]>
- * README :
- more description.
* NvdlBuiltInValidationProvider.cs :
When it is "allow", it should not always return false.
* NvdlFilteredXmlReader.cs :
Modified: trunk/mcs/class/Commons.Xml.Relaxng/README
===================================================================
--- trunk/mcs/class/Commons.Xml.Relaxng/README 2005-03-07 06:03:04 UTC (rev
41502)
+++ trunk/mcs/class/Commons.Xml.Relaxng/README 2005-03-07 06:27:13 UTC (rev
41503)
@@ -114,11 +114,12 @@
still not in standard status as yet.
http://www.asahi-net.or.jp/~eb2m-mrt/dsdl/
- NOTE: It is "just started" implementation and have many limitations
- and (maybe) problems.
+ NOTE: It is "just started" implementation and may have limitations
+ and problems.
By default, NvdlValidatingReader supports RELAX NG, RELAX NG Compact
- syntax, and XML Schema.
+ syntax, W3C XML Schema and built-in NVDL validations, however without
+ "PlanAtt" support.
*** Usage
@@ -129,14 +130,72 @@
XmlReader vr = new NvdlValidatingReader (
new XmlTextReader ("index.html"), rules);
+ static NvdlReader.Read() method reads argument XmlReader and return
+ NvdlRules instance.
+
+ NvdlValidatingReader is instantiated from a) XmlReader to be validated,
+ and b) NvdlRules as validating NVDL script.
+
2) custom validation support
NvdlConfig config = new NvdlConfig ();
- config.AddProvider (myOwnSchematronProvider);
+ config.AddProvider (myOwnSchematronProvider); // [*1]
config.AddProvider (myOwnExamplotronProvider);
- NvdlRules rules = NvdlReader.Read (new XmlTextReader
("myschemas.nvdl"));
+ NvdlRules rules = NvdlReader.Read (
+ new XmlTextReader ("myscript.nvdl"));
XmlReader vr = new NvdlValidatingReader (
new XmlTextReader ("myinstance.xml"), rules, config);
-(Will follow up later.)
+ NvdlConfig is here used to support "custom validation provider". In
+ NVDL script, there could be any schema language referenced. I'll
+ describe what validation provider is immediately later.
+ [*1] Of course Schematron should receive its input as XPathNavigator
+ or IXPathNavigable, but we could still use ReadSubtree() in .NET 2.0.
+
+*** NvdlValidationProvider
+
+ To support your own validation language, you have to design your
+ own extension to NvdlValidationProdiver type.
+
+ Abstract NvdlValidationProvider should implement at least one of
+ the virtual methods below:
+
+ - CreateValidatorGenerator (NvdlValidate validate,
+ string schemaType,
+ NvdlConfig config)
+ - CreateValidatorGenerator (XmlReader schema,
+ NvdlConfig config)
+
+ Each of them returns NvdlValidatorGenerator implementation (will
+ describe later).
+
+ The first one receives MIME type (schemaType) and "validate" NVDL
+ element. If you don't override it, it treats only "*/*-xml" and thus
+ creates XmlReader from either schema attribute or schema element
+ and passes it to another CreateValidatorGenerator() overload.
+ If this (possibly overriden) method returns null, then this validation
+ provider does not support the MIME type or the schema document.
+
+ The second one is a shorthand method to handle "*/*-xml". By default
+ it just returns null.
+
+ Most of validation providers will only have to override the second
+ overload. Few providers such as RELAX NG Compact Syntax support will
+ have to overide the first overload.
+
+*** NvdlValidatorGenerator
+
+ Abstract NvdlValidatorGenerator.CreateValidator() method is designed
+ to create XmlReader from input XmlReader.
+
+ For example, we have NvdlXsdValidatorGenerator class. It internally
+ uses XmlValidatingReader which takes XmlReader as its constructor
+ parameter.
+
+ An instance of NvdlValidatorGenerator will be created for each
+ "validate" element in the NVDL script. When the validate element
+ applies (for a PlanElem), it creates validator XmlReader.
+
+
+
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches