-// Author: Dwivedi, Ajay kumar\r
-// Adwiv@Yahoo.com\r
+//\r
+// System.Xml.Schema.XmlSchemaSimpleContentExtension.cs\r
+//\r
+// Author:\r
+// Dwivedi, Ajay kumar Adwiv@Yahoo.com\r
+// Atsushi Enomoto ginga@kit.hi-ho.ne.jp\r
+//\r
+
+//
+// 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.
+//
using System;\r
using System.Xml;\r
using System.Xml.Serialization;\r
private XmlSchemaAnyAttribute any;\r
private XmlSchemaObjectCollection attributes;\r
private XmlQualifiedName baseTypeName;\r
- private static string xmlname = "extension";\r
+ const string xmlname = "extension";\r
\r
public XmlSchemaSimpleContentExtension()\r
{\r
set{ any = value; }\r
}\r
\r
+ // internal properties\r
+ internal override bool IsExtension {\r
+ get { return true; }\r
+ }\r
+\r
///<remarks>\r
/// 1. Base must be present and a QName\r
///</remarks>\r
- [MonoTODO]\r
- internal int Compile(ValidationEventHandler h, XmlSchema schema)\r
+ internal override int Compile(ValidationEventHandler h, XmlSchema schema)\r
{\r
// If this is already compiled this time, simply skip.\r
if (this.IsComplied (schema.CompilationId))\r
return 0;\r
\r
+#if NET_2_0\r
+ if (AnyAttribute != null)\r
+ AnyAttribute.Parent = this;\r
+ foreach (XmlSchemaObject obj in Attributes)\r
+ obj.Parent = this;\r
+#endif\r
+\r
+ if (this.isRedefinedComponent) {\r
+ if (Annotation != null)\r
+ Annotation.isRedefinedComponent = true;\r
+ if (AnyAttribute != null)\r
+ AnyAttribute.isRedefinedComponent = true;\r
+ foreach (XmlSchemaObject obj in Attributes)\r
+ obj.isRedefinedComponent = true;\r
+ }\r
+\r
if(BaseTypeName == null || BaseTypeName.IsEmpty)\r
{\r
- error(h, "base must be present and a QName");\r
+ error(h, "base must be present, as a QName");\r
}\r
else if(!XmlSchemaUtil.CheckQName(BaseTypeName))\r
error(h,"BaseTypeName must be a QName");\r
return errorCount;\r
}\r
\r
- [MonoTODO]\r
- internal int Validate(ValidationEventHandler h)\r
+ internal override XmlQualifiedName GetBaseTypeName ()\r
+ {\r
+ return baseTypeName;\r
+ }\r
+\r
+ internal override XmlSchemaParticle GetParticle ()\r
{\r
+ return null;\r
+ }\r
+\r
+ internal override int Validate(ValidationEventHandler h, XmlSchema schema)\r
+ {\r
+ if (IsValidated (schema.ValidationId))\r
+ return errorCount;\r
+\r
+ XmlSchemaType st = schema.SchemaTypes [baseTypeName] as XmlSchemaType;\r
+ if (st != null) {\r
+ XmlSchemaComplexType ct = st as XmlSchemaComplexType;\r
+ if (ct != null && ct.ContentModel is XmlSchemaComplexContent)\r
+ error (h, "Specified type is complex type which contains complex content.");\r
+ st.Validate (h, schema);\r
+ actualBaseSchemaType = st;\r
+ } else if (baseTypeName == XmlSchemaComplexType.AnyTypeName) {\r
+ actualBaseSchemaType = XmlSchemaComplexType.AnyType;
+ } else if (XmlSchemaUtil.IsBuiltInDatatypeName (baseTypeName)) {\r
+ actualBaseSchemaType = XmlSchemaDatatype.FromName (baseTypeName);\r
+ if (actualBaseSchemaType == null)\r
+ error (h, "Invalid schema datatype name is specified.");\r
+ }\r
+ // otherwise, it might be missing sub components.\r
+ else if (!schema.IsNamespaceAbsent (baseTypeName.Namespace))\r
+ error (h, "Referenced base schema type " + baseTypeName + " was not found in the corresponding schema.");\r
+\r
+ ValidationId = schema.ValidationId;\r
return errorCount;\r
}\r
+\r
//<extension \r
//base = QName \r
//id = ID \r