2 // RelaxngMergedProvider.cs
\r
5 // Atsushi Enomoto <atsushi@ximian.com>
\r
7 // (C)2004 Novell Inc.
\r
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Collections;
\r
32 using Commons.Xml.Relaxng.XmlSchema;
\r
34 using XSchema = System.Xml.Schema.XmlSchema;
\r
36 namespace Commons.Xml.Relaxng
\r
38 public class RelaxngMergedProvider : RelaxngDatatypeProvider
\r
40 static RelaxngMergedProvider defaultProvider;
\r
41 static RelaxngMergedProvider ()
\r
43 RelaxngMergedProvider p = new RelaxngMergedProvider ();
\r
45 p ["http://www.w3.org/2001/XMLSchema-datatypes"] = XsdDatatypeProvider.Instance;
\r
46 p [XSchema.Namespace] = XsdDatatypeProvider.Instance;
\r
48 p [String.Empty] = RelaxngNamespaceDatatypeProvider.Instance;
\r
49 defaultProvider = p;
\r
52 public static RelaxngMergedProvider DefaultProvider {
\r
53 get { return defaultProvider; }
\r
56 Hashtable table = new Hashtable ();
\r
58 public RelaxngMergedProvider ()
\r
62 public RelaxngDatatypeProvider this [string ns] {
\r
63 get { return table [ns] as RelaxngDatatypeProvider; }
\r
64 set { table [ns] = value; }
\r
67 public override RelaxngDatatype GetDatatype (string name, string ns, RelaxngParamList parameters) {
\r
68 // TODO: parameter support (write schema and get type)
\r
70 RelaxngDatatypeProvider p = table [ns] as RelaxngDatatypeProvider;
\r
73 return p.GetDatatype (name, ns, parameters);
\r