2 // Commons.Xml.Relaxng.Derivative.RdpObjects.cs
5 // Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
7 // 2003 Atsushi Enomoto "No rights reserved."
9 // Copyright (c) 2004 Novell Inc.
10 // All rights reserved
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 using System.Collections;
36 using System.Collections.Specialized;
39 namespace Commons.Xml.Relaxng.Derivative
42 /// Datatype Related Classes
44 public class RdpParamList : ArrayList
46 public RdpParamList () : base ()
53 public RdpParam (string localName, string value)
55 this.localName = localName;
61 get { return this.value; }
65 public string LocalName {
66 get { return localName; }
70 public class RdpDatatype
72 RelaxngDatatypeProvider provider;
75 RelaxngDatatype datatype;
77 public RdpDatatype (string ns, string localName, RelaxngParamList parameters, RelaxngDatatypeProvider provider)
80 this.localName = localName;
81 this.provider = provider;
83 provider = RelaxngMergedProvider.DefaultProvider;
84 datatype = provider.GetDatatype (localName, ns, parameters);
85 if (datatype == null) {
86 throw new RelaxngException (String.Format ("Invalid datatype was found for namespace '{0}' and local name '{1}'", ns, localName));
90 public string NamespaceURI {
94 public string LocalName {
95 get { return localName; }
98 public bool IsContextDependent {
99 get { return datatype.IsContextDependent; }
102 public virtual bool IsAllowed (string value, XmlReader reader)
104 return datatype.IsValid (value, reader);
107 static char [] wsChars = new char [] {' ', '\n', '\r', '\t'};
109 public virtual bool IsTypeEqual (string s1, string s2, XmlReader reader)
111 return datatype.CompareString (s1, s2, reader);