Update mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngPattern.cs
authorAlexandre Alapetite <alexandre@alapetite.fr>
Sat, 28 Jul 2012 17:36:22 +0000 (20:36 +0300)
committerAlexandre Alapetite <alexandre@alapetite.fr>
Sat, 28 Jul 2012 17:36:22 +0000 (20:36 +0300)
- Choice of using the parser for compact syntax or not based on the file extension,
in order to allow mixed grammars (e.g. including RNG from RNC).
- Correction in base URI for compact syntax in order to allow including grammar files located in different directories.

mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngPattern.cs

index a6e19404b371f929586c30c7ff59ec39b32a1bdd..009c03b6bb71a48e39602cf3a5c7a9a7d41689a6 100755 (executable)
@@ -83,8 +83,8 @@ namespace Commons.Xml.Relaxng
                        RelaxngGrammar g = null;
                        RelaxngPattern p;
                        try {
-                               if (grammar.IsSourceCompactSyntax) {
-                                       p = RncParser.ParseRnc (new StreamReader ((Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream))), null, BaseUri, nsContext);
+                               if (uri.AbsolutePath.EndsWith(".rnc", StringComparison.InvariantCultureIgnoreCase)) {
+                                       p = RncParser.ParseRnc (new StreamReader ((Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream))), null, uri.AbsoluteUri, nsContext);
                                } else {
                                        xtr = new XmlTextReader (uri.AbsoluteUri, (Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream)));
                                        RelaxngReader r = new RelaxngReader (xtr, nsContext, grammar.Resolver);