RelaxngValidatingReader is an implementation to validate XML with RELAX NG\r
grammar. You can use full standard grammar components with it.\r
\r
- Currently it supports only grammar xml syntax (in the future it will \r
- support compact syntax).\r
+ Currently it supports both xml syntax and compact syntax.\r
\r
It supports RELAX NG predefined datatypes and XML Schema datatypes (its\r
DatatypeLibrary is http://www.w3.org/2001/XMLSchema-datatypes ).\r
\r
- All classes which is expected to use are in namespace Commons.Xml.Relaxng.\r
+ All classes which is expected to use are in namespace Commons.Xml.Relaxng,\r
+ except for Commons.Xml.Relaxng.Rnc.RncParser class (which is used to parse\r
+ compact syntax).\r
There is another namespace Commons.Xml.Relaxng.Derivative which is not\r
expected to be used in users custom classes, though the classes are public\r
as yet.\r
\r
+\r
+** Grammar Object Model\r
+\r
+ RELAX NG grammar structure is represented in abstract RelaxngPattern class\r
+ and its derivations. The easiest way to get this instance is to use\r
+ static Read() method of RelaxngPattern class:\r
+\r
+ RelaxngPattern pattern = RelaxngPattern.Read (\r
+ new XmlTextReader ("relaxng.rng");\r
+\r
+ You can also use RelaxngPattern class to reuse grammar instance, as\r
+ already described (see Grammar Object Model).\r
+\r
+ And also, RelaxngGrammar and its contents can be created with managed code\r
+ like System.Xml.Schema.XmlSchema.\r
+\r
+\r
+** Compact Syntax Support\r
+\r
+ Commons.Xml.Relaxng.dll also supports RELAX NG Compact Syntax. To parse\r
+ compact syntax file, use Commons.Xml.Relaxng.Rnc.RncParser class:\r
+\r
+ RncParser parser = new RncParser (new NameTable ());\r
+ TextReader source = new StreamReader ("relaxng.rnc");\r
+ RelaxngGrammar grammar = parser.Parse (source);\r
+\r
+\r
** Validating Reader usage\r
\r
RelaxngValidatingReader is used to validate XML document with RELAX NG\r
RelaxngValidatingReader reader = \r
new RelaxngValidatingReader (instance, grammar);\r
\r
- You can also use RelaxngPattern class to reuse grammar instance:\r
-\r
- RelaxngPattern pattern = RelaxngPattern.Read (\r
- new XmlTextReader ("relaxng.rng");\r
-\r
- And also, RelaxngGrammar and its contents can be created with managed code\r
- like System.Xml.Schema.XmlSchema.\r
-\r
Then Read() method (and other reading methods such as ReadElementString())\r
- reads the instance, validating with the grammar.\r
+ reads the instance, validating with the supplied grammar.\r
\r
\r
** Datatype support\r
not handle the same name define components properly.\r
- Name class analysis and constraint check is not implemented (part\r
of spec 7).\r
- - Empty string won't be validated properly.\r
+ - Empty string might not be validated properly.\r
\r