Sfoglia il codice sorgente

2003-08-07 Atsushi Enomoto <[email protected]>

	* BuiltInDatatypes.cs : Fixed whitespace facet in XsdToken.
	  Tokenized type of nmtokens and entities is string [].
	* XmlSchema.cs : Changed IsCompile implementation a bit.
	  Compile() should reset compiled contents.
	* XmlSchemaDatatype.cs : Fixed collapsing Normalize().
	* XmlSchemaObject.cs : added CompilationId initialization.

svn path=/trunk/mcs/; revision=17164
Atsushi Eno 22 anni fa
parent
commit
cd243c7eb6

+ 11 - 2
mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs

@@ -112,6 +112,7 @@ namespace Mono.Xml.Schema
 	{
 		internal XsdToken ()
 		{
+			this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
 		}
 
 		public override XmlTokenizedType TokenizedType {
@@ -176,7 +177,11 @@ namespace Mono.Xml.Schema
 			get { return typeof (string []); }
 		}
 
-		// ParseValue () method is as same as that of xs:string
+		readonly char [] whitespaceArray = new char [] {' '};
+		public override object ParseValue (string value, XmlNameTable nt, XmlNamespaceManager nsmgr)
+		{
+			return this.Normalize (value).Split (whitespaceArray);
+		}
 	}
 
 	// xs:Name
@@ -307,7 +312,11 @@ namespace Mono.Xml.Schema
 			get { return typeof (string []); }
 		}
 
-		// ParseValue () method is as same as that of xs:string
+		readonly char [] whitespaceArray = new char [] {' '};
+		public override object ParseValue (string value, XmlNameTable nt, XmlNamespaceManager nsmgr)
+		{
+			return this.Normalize (value).Split (whitespaceArray);
+		}
 	}
 
 	// xs:NOTATION

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

@@ -1,3 +1,12 @@
+2003-08-07  Atsushi Enomoto  <[email protected]>
+
+	* BuiltInDatatypes.cs : Fixed whitespace facet in XsdToken.
+	  Tokenized type of nmtokens and entities is string [].
+	* XmlSchema.cs : Changed IsCompile implementation a bit.
+	  Compile() should reset compiled contents.
+	* XmlSchemaDatatype.cs : Fixed collapsing Normalize().
+	* XmlSchemaObject.cs : added CompilationId initialization.
+
 2003-08-05  Lluis Sanchez Gual <[email protected]>
 
 	* XmlSchema.cs: Set IsCompiled to true after compiling.

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

@@ -146,7 +146,7 @@ namespace System.Xml.Schema
                 [XmlIgnore]
                 public bool IsCompiled
                 {
-                        get{ return isCompiled;}
+                        get{ return this.CompilationId != Guid.Empty;}
                 }
 
                 [XmlIgnore]
@@ -270,6 +270,15 @@ namespace System.Xml.Schema
 			schemas = new XmlSchemaCollection ();
 			schemas.Add (this);
 
+			attributeGroups = new XmlSchemaObjectTable ();
+			attributes = new XmlSchemaObjectTable ();
+			elements = new XmlSchemaObjectTable ();
+			groups = new XmlSchemaObjectTable ();
+			missingElementTypeRefs.Clear ();
+			missingBaseSchemaTypeRefs.Clear ();
+			notations = new XmlSchemaObjectTable ();
+			schemaTypes = new XmlSchemaObjectTable ();
+
 			//1. Union and List are not allowed in block default
                         if(BlockDefault != XmlSchemaDerivationMethod.All)
                         {

+ 13 - 3
mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs

@@ -36,17 +36,27 @@ namespace System.Xml.Schema
 
 		char [] wsChars = new char [] {' ', '\t', '\n', '\r'};
 
+		StringBuilder sb = new StringBuilder ();
 		internal string Normalize (string s)
 		{
 			switch (Whitespace) {
 			case XsdWhitespaceFacet.Collapse:
-				return String.Join (" ", s.Trim ().Split (wsChars));
+				string [] arr = s.Trim ().Split (wsChars);
+				foreach (string one in arr)
+					if (one != "") {
+						sb.Append (one);
+						sb.Append (" ");
+					}
+				string result = sb.ToString ();
+				sb.Length = 0;
+				return result.Trim ();
 			case XsdWhitespaceFacet.Replace:
-				StringBuilder sb = new StringBuilder (s);
+				sb.Length = 0;
+				sb.Append (s);
 				sb.Replace ('\r', ' ');
 				sb.Replace ('\n', ' ');
 				sb.Replace ('\t', ' ');
-				string result = sb.ToString ();
+				result = sb.ToString ();
 				sb.Length = 0;
 				return result;
 			default:

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

@@ -25,6 +25,7 @@ namespace System.Xml.Schema
 		{
 			namespaces = new XmlSerializerNamespaces();
 			unhandledAttributeList = null;
+			CompilationId = Guid.Empty;
 		}
 
 		[XmlIgnore]