-//
-// Mono.Xml.Schema.XsdWildcard.cs
-//
-// Author:
-// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
-//
-// (C)2003 Atsushi Enomoto
-//
-//
-// This class represents common part of xs:any and xs:anyAttribute
-//
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
+//\r
+// Mono.Xml.Schema.XsdWildcard.cs\r
+//\r
+// Author:\r
+// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)\r
+//\r
+// (C)2003 Atsushi Enomoto\r
+//\r
+//\r
+// This class represents common part of xs:any and xs:anyAttribute\r
+//\r
+//\r
+\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
using System;\r
using System.Collections.Specialized;\r
using System.Xml;\r
\r
public XmlSchemaContentProcessing ResolvedProcessing;\r
public string TargetNamespace;\r
+ public bool SkipCompile;\r
public bool HasValueAny;\r
public bool HasValueLocal;\r
public bool HasValueOther;\r
public bool HasValueTargetNamespace;\r
public StringCollection ResolvedNamespaces;\r
\r
+ void Reset ()\r
+ {\r
+ HasValueAny = false;\r
+ HasValueLocal = false;\r
+ HasValueOther = false;\r
+ HasValueTargetNamespace = false;\r
+ ResolvedNamespaces = new StringCollection ();\r
+ }\r
+\r
public void Compile (string nss,\r
ValidationEventHandler h, XmlSchema schema)\r
{\r
+ if (SkipCompile)\r
+ return; // used by XmlSchemaAny.AnyTypeContent.\r
+\r
+ Reset ();\r
int nscount = 0;\r
string actualNamespace = nss == null ? "##any" : nss;\r
string[] nslist = XmlSchemaUtil.SplitList(actualNamespace);\r
- ResolvedNamespaces = new StringCollection ();
- for (int i = 0; i < nslist.Length; i++) {
- string ns = nslist [i];
+ for (int i = 0; i < nslist.Length; i++) {\r
+ string ns = nslist [i];\r
switch(ns) {\r
case "##any": \r
- if (HasValueAny)
- xsobj.error (h, "Multiple specification of ##any was found.");
+ if (HasValueAny)\r
+ xsobj.error (h, "Multiple specification of ##any was found.");\r
nscount |= 1;\r
- HasValueAny = true;
+ HasValueAny = true;\r
break;\r
case "##other":\r
- if (HasValueOther)
- xsobj.error (h, "Multiple specification of ##other was found.");
+ if (HasValueOther)\r
+ xsobj.error (h, "Multiple specification of ##other was found.");\r
nscount |= 2;\r
- HasValueOther = true;
+ HasValueOther = true;\r
break;\r
case "##targetNamespace":\r
- if (HasValueTargetNamespace)
- xsobj.error (h, "Multiple specification of ##targetNamespace was found.");
+ if (HasValueTargetNamespace)\r
+ xsobj.error (h, "Multiple specification of ##targetNamespace was found.");\r
nscount |= 4;\r
HasValueTargetNamespace = true;\r
break;\r
case "##local":\r
- if (HasValueLocal)
- xsobj.error (h, "Multiple specification of ##local was found.");
+ if (HasValueLocal)\r
+ xsobj.error (h, "Multiple specification of ##local was found.");\r
nscount |= 8;\r
- HasValueLocal = true;
+ HasValueLocal = true;\r
break;\r
default:\r
if(!XmlSchemaUtil.CheckAnyUri(ns))\r
xsobj.error(h,"the namespace is not a valid anyURI");\r
- else if (ResolvedNamespaces.Contains (ns))
- xsobj.error (h, "Multiple specification of '" + ns + "' was found.");
+ else if (ResolvedNamespaces.Contains (ns))\r
+ xsobj.error (h, "Multiple specification of '" + ns + "' was found.");\r
else {\r
nscount |= 16;\r
- ResolvedNamespaces.Add (ns);
- }
+ ResolvedNamespaces.Add (ns);\r
+ }\r
break;\r
}\r
}\r
public bool ValidateWildcardAllowsNamespaceName (string ns,\r
ValidationEventHandler h, XmlSchema schema, bool raiseError)\r
{\r
- if (HasValueAny)
- return true;
- if (HasValueOther && ns != TargetNamespace)
- return true;
- if (HasValueTargetNamespace && ns == TargetNamespace)
- return true;
- if (HasValueLocal && ns == "")
- return true;
- for (int i = 0; i < ResolvedNamespaces.Count; i++)
- if (ns == ResolvedNamespaces [i])
- return true;
- if (raiseError)
- xsobj.error (h, "This wildcard does not allow the namespace: " + ns);
- return false;
+ if (HasValueAny)\r
+ return true;\r
+ if (HasValueOther && ns != TargetNamespace)\r
+ return true;\r
+ if (HasValueTargetNamespace && ns == TargetNamespace)\r
+ return true;\r
+ if (HasValueLocal && ns == "")\r
+ return true;\r
+ for (int i = 0; i < ResolvedNamespaces.Count; i++)\r
+ if (ns == ResolvedNamespaces [i])\r
+ return true;\r
+ if (raiseError)\r
+ xsobj.error (h, "This wildcard does not allow the namespace: " + ns);\r
+ return false;\r
}\r
\r
// 3.10.6 Wildcard Subset\r