Bladeren bron

2004-01-08 Atsushi Enomoto <[email protected]>

	* XmlSchemaObjectTable.cs : Modified enumerator's Current to return
	  DictionaryEntry.
	* XmlSchemaComplexType.cs, XmlSchemaUtil.cs :
	  In reflection to object table enumerator change.

svn path=/trunk/mcs/; revision=21827
Atsushi Eno 22 jaren geleden
bovenliggende
commit
3acad19b5f

+ 7 - 0
mcs/class/System.XML/System.Xml.Schema/ChangeLog

@@ -1,3 +1,10 @@
+2004-01-08  Atsushi Enomoto  <[email protected]>
+
+	* XmlSchemaObjectTable.cs : Modified enumerator's Current to return
+	  DictionaryEntry.
+	* XmlSchemaComplexType.cs, XmlSchemaUtil.cs :
+	  In reflection to object table enumerator change.
+
 2004-01-08  Atsushi Enomoto  <[email protected]>
 
 	* XmlSchemaElement.cs : Fixed incorrect unique particle attribution

+ 14 - 9
mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs

@@ -131,7 +131,6 @@ namespace System.Xml.Schema
 			get{ return resolvedContentType; }
 		}
 		[XmlIgnore]
-		[MonoTODO ("Derivation is not supported yet.")]
 		public XmlSchemaParticle ContentTypeParticle 
 		{
 			get{ return contentTypeParticle; }
@@ -167,7 +166,6 @@ namespace System.Xml.Schema
 		///		4. block must be absent
 		///		
 		/// </remarks>
-		[MonoTODO]
 		internal override int Compile(ValidationEventHandler h, XmlSchema schema)
 		{
 			// If this is already compiled this time, simply skip.
@@ -357,7 +355,6 @@ namespace System.Xml.Schema
 			return errorCount;
 		}
 
-		[MonoTODO]
 		internal override int Validate(ValidationEventHandler h, XmlSchema schema)
 		{
 			if (IsValidated (schema.ValidationId))
@@ -410,7 +407,8 @@ namespace System.Xml.Schema
 
 			// 3.4.6 Properties Correct :: 5 (Two distinct ID attributes)
 			XmlSchemaAttribute idAttr = null;
-			foreach (XmlSchemaAttribute attr in attributeUses) {
+			foreach (DictionaryEntry entry in attributeUses) {
+				XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
 				XmlSchemaDatatype dt = attr.AttributeType as XmlSchemaDatatype;
 				if (dt != null && dt.TokenizedType != XmlTokenizedType.ID)
 					continue;
@@ -570,8 +568,10 @@ namespace System.Xml.Schema
 				// defines as to include base type's attribute uses.
 				localAnyAttribute = cce.AnyAttribute;
 				if (baseComplexType != null) {
-					foreach (XmlSchemaAttribute attr in baseComplexType.AttributeUses)
+					foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
+						XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
 						XmlSchemaUtil.AddToTable (attributeUses, attr, attr.QualifiedName, h);
+					}
 					baseAnyAttribute = baseComplexType.AttributeWildcard;
 				}
 				// attributes
@@ -612,7 +612,8 @@ namespace System.Xml.Schema
 				errorCount += XmlSchemaUtil.ValidateAttributesResolved (
 					this.attributeUses, h, schema, ccr.Attributes, 
 					ccr.AnyAttribute, ref attributeWildcard, null);
-				foreach (XmlSchemaAttribute attr in baseComplexType.AttributeUses) {
+				foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
+					XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
 					if (attributeUses [attr.QualifiedName] == null)
 						XmlSchemaUtil.AddToTable (attributeUses, attr, attr.QualifiedName, h);
 				}
@@ -637,8 +638,10 @@ namespace System.Xml.Schema
 				if (baseComplexType != null) {
 					baseAnyAttribute = baseComplexType.AttributeWildcard;
 
-					foreach (XmlSchemaAttribute attr in baseComplexType.AttributeUses)
+					foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
+						XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
 						XmlSchemaUtil.AddToTable (attributeUses, attr, attr.QualifiedName, h);
+					}
 				}
 				if (baseAnyAttribute != null && localAnyAttribute != null)
 					// 1.3 attribute wildcard subset. (=> 3.10.6)
@@ -743,7 +746,8 @@ namespace System.Xml.Schema
 			if ((baseComplexType.FinalResolved & XmlSchemaDerivationMethod.Extension) != 0)
 				error (h, "Derivation by extension is prohibited.");
 			// 1.2
-			foreach (XmlSchemaAttribute ba in baseComplexType.AttributeUses) {
+			foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
+				XmlSchemaAttribute ba = (XmlSchemaAttribute) entry.Value;
 				XmlSchemaAttribute da = AttributeUses [ba.QualifiedName] as XmlSchemaAttribute;
 				if (da == null)
 					error (h, "Invalid complex type derivation by extension was found. Missing attribute was found: " + ba.QualifiedName + " .");
@@ -834,7 +838,8 @@ namespace System.Xml.Schema
 			}
 
 			// 2.
-			foreach (XmlSchemaAttribute attr in this.AttributeUses) {
+			foreach (DictionaryEntry entry in this.AttributeUses) {
+				XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
 				XmlSchemaAttribute baseAttr = baseType.AttributeUses [attr.QualifiedName] as XmlSchemaAttribute;
 				if (baseAttr != null) {
 					// 2.1

+ 1 - 1
mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs

@@ -105,7 +105,7 @@ namespace System.Xml.Schema
 			}
 			object IEnumerator.Current
 			{
-				get { return xenum.Value; }
+				get { return xenum.Entry; }
 			}
 			DictionaryEntry IDictionaryEnumerator.Entry {
 				get { return xenum.Entry; }

+ 3 - 10
mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs

@@ -90,15 +90,7 @@ namespace System.Xml.Schema
 		public static bool CheckNCName(string name)
 		{
 			//check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#NCName
-			try
-			{
-				XmlConvert.VerifyNCName(name);
-				return true;
-			}
-			catch(Exception)
-			{
-				return false;
-			}
+			return XmlChar.IsNCName (name);
 		}
 
 		public static bool CheckQName(XmlQualifiedName qname)
@@ -470,7 +462,8 @@ namespace System.Xml.Schema
 						if (anyAttribute == null)
 							anyAttributeUse = grp.AnyAttributeUse;
 					}
-					foreach (XmlSchemaAttribute attr in grp.AttributeUses) {
+					foreach (DictionaryEntry entry in grp.AttributeUses) {
+						XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
 						if (attr.RefName != null && attr.RefName != XmlQualifiedName.Empty)
 							AddToTable (attributesResolved, attr, attr.RefName, h);
 						else