2 // Commons.Xml.Relaxng.Derivative.RdpObjects.cs
\r
5 // Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
\r
7 // 2003 Atsushi Enomoto "No rights reserved."
\r
9 // Copyright (c) 2004 Novell Inc.
\r
10 // All rights reserved
\r
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;
\r
36 using System.Collections.Specialized;
\r
39 namespace Commons.Xml.Relaxng.Derivative
\r
42 /// Datatype Related Classes
\r
44 public class RdpParamList : ArrayList
\r
46 public RdpParamList () : base ()
\r
51 public class RdpParam
\r
53 public RdpParam (string localName, string value)
\r
55 this.localName = localName;
\r
60 public string Value {
\r
61 get { return this.value; }
\r
65 public string LocalName {
\r
66 get { return localName; }
\r
70 public class RdpDatatype
\r
72 RelaxngDatatypeProvider provider;
\r
75 RelaxngDatatype datatype;
\r
77 public RdpDatatype (string ns, string localName, RelaxngParamList parameters, RelaxngDatatypeProvider provider)
\r
80 this.localName = localName;
\r
81 this.provider = provider;
\r
82 if (provider == null)
\r
83 provider = RelaxngMergedProvider.DefaultProvider;
\r
84 datatype = provider.GetDatatype (localName, ns, parameters);
\r
85 if (datatype == null) {
\r
86 throw new RelaxngException (String.Format ("Invalid datatype was found for namespace '{0}' and local name '{1}'", ns, localName));
\r
90 public string NamespaceURI {
\r
94 public string LocalName {
\r
95 get { return localName; }
\r
98 public virtual bool IsAllowed (string value, XmlReader reader)
\r
100 return datatype.IsValid (value, reader);
\r
103 static char [] wsChars = new char [] {' ', '\n', '\r', '\t'};
\r
105 public virtual bool IsTypeEqual (string s1, string s2, XmlReader reader)
\r
107 return datatype.CompareString (s1, s2, reader);
\r