Author: atsushi
Date: 2006-07-26 06:13:56 -0400 (Wed, 26 Jul 2006)
New Revision: 62988
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/ChangeLog
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
trunk/mcs/class/System.XML/System.Xml/ChangeLog
trunk/mcs/class/System.XML/System.Xml/XmlReader.cs
trunk/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
Log:
2006-07-26 Atsushi Enomoto <[EMAIL PROTECTED]>
Refactoring compilation to make Compile() portable to
XmlSchemaSet.Compile() and fix multi-schema bugs (not done yet)
* XmlSchema.cs :
Removed "root schema" concept from Compile().
Since nested inclusion does not result in an error, the role of
schemaLocationStack is identical to handledUris, thus removed it.
The handledUris does not have to be a field.
Moved NamedIdentities and IDCollections to XmlSchemaSet.
Renamed a Compile() which is called from XmlSchemaCollection and
XmlSchemaSet as CompileSubset(). Renamed private Compile() as
DoCompile().
public Compile() now internally creates a new XmlSchemaSet and
compiles the set.
* XmlSchemaCollection.cs : now it hooks its schemaSet's validation
event handler and thus XmlSchemaSet does not need to check this
collection's event handler by itself.
XmlSchema.Compile() -> XmlSchema.CompileSubset().
* XmlSchemaSet.cs :
Removed SchemaCollection which became unneccessary.
Added NamedIdentities and IDCollection.
XmlSchema.Compile() -> XmlSchema.CompileSubset().
* XmlSchemaAttributeGroupRef.cs, XmlSchemaXPath.cs
XmlSchemaSimpleTypeList.cs, XmlSchemaComplexContentRestriction.cs,
XmlSchemaGroup.cs, XmlSchemaComplexContentExtension.cs,
XmlSchemaSequence.cs, XmlSchemaSimpleContentRestriction.cs,
XmlSchemaSimpleContentExtension.cs, XmlSchemaAny.cs,
XmlSchemaElement.cs, XmlSchemaNotation.cs, XmlSchemaAll.cs,
XmlSchemaComplexType.cs, XmlSchemaAnnotation.cs,
XmlSchemaAttributeGroup.cs, XmlSchemaSimpleTypeRestriction.cs,
XmlSchemaSimpleContent.cs, XmlSchemaGroupRef.cs,
XmlSchemaChoice.cs, XmlSchemaSimpleType.cs,
XmlSchemaIdentityConstraint.cs, XmlSchemaSimpleTypeUnion.cs,
XmlSchemaAnyAttribute.cs, XmlSchemaComplexContent.cs,
XmlSchemaAttribute.cs, XmlSchemaObject.cs :
removed XmlSchemaObject.IsCompiled(). Check compilation state by
comparing compilation ID directly.
* XmlReader.cs :
For DTD validator, call to SetSchemas() makes no sense.
* XmlValidatingReader.cs : now it internally holds old
XmlSchemaCollection instead of new XmlSchemaSet, to make
XmlSchemaSet.SchemaCollection unneccessary.
Removed SetSchemas() since it is now extraneous because of the
XmlReaderChange above.
Modified: trunk/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/ChangeLog 2006-07-26 09:44:21 UTC
(rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml/ChangeLog 2006-07-26 10:13:56 UTC
(rev 62988)
@@ -1,3 +1,13 @@
+2006-07-26 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlReader.cs :
+ For DTD validator, call to SetSchemas() makes no sense.
+ * XmlValidatingReader.cs : now it internally holds old
+ XmlSchemaCollection instead of new XmlSchemaSet, to make
+ XmlSchemaSet.SchemaCollection unneccessary.
+ Removed SetSchemas() since it is now extraneous because of the
+ XmlReaderChange above.
+
2006-07-25 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlConvert.cs : TimeSpan conversion for TimeSpan.MinValue was
Modified: trunk/mcs/class/System.XML/System.Xml/XmlReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlReader.cs 2006-07-26 09:44:21 UTC
(rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml/XmlReader.cs 2006-07-26 10:13:56 UTC
(rev 62988)
@@ -412,8 +412,6 @@
case ValidationType.Schema:
return new XmlSchemaValidatingReader (reader,
settings);
}
- if (xvr != null)
- xvr.SetSchemas (settings.Schemas);
// Actually I don't think they are treated in DTD
validation though...
if ((settings.ValidationFlags &
XmlSchemaValidationFlags.ProcessIdentityConstraints) == 0)
Modified: trunk/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -61,7 +61,7 @@
bool resolverSpecified;
ValidationType validationType;
// for 2.0: Now it is obsolete. It is allocated only when it is
required
- XmlSchemaSet schemas;
+ XmlSchemaCollection schemas;
DTDValidatingReader dtdReader;
IHasXmlSchemaInfo schemaInfo;
StringBuilder storedCharacters;
@@ -289,16 +289,11 @@
public XmlSchemaCollection Schemas {
get {
if (schemas == null)
- schemas = new XmlSchemaSet ();
- return schemas.SchemaCollection;
+ schemas = new XmlSchemaCollection
(NameTable);
+ return schemas;
}
}
- internal void SetSchemas (XmlSchemaSet schemas)
- {
- this.schemas = schemas;
- }
-
public object SchemaType {
get { return schemaInfo.SchemaType; }
}
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/ChangeLog 2006-07-26
09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/ChangeLog 2006-07-26
10:13:56 UTC (rev 62988)
@@ -1,3 +1,43 @@
+2006-07-26 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ Refactoring compilation to make Compile() portable to
+ XmlSchemaSet.Compile() and fix multi-schema bugs (not done yet)
+
+ * XmlSchema.cs :
+ Removed "root schema" concept from Compile().
+ Since nested inclusion does not result in an error, the role of
+ schemaLocationStack is identical to handledUris, thus removed it.
+ The handledUris does not have to be a field.
+ Moved NamedIdentities and IDCollections to XmlSchemaSet.
+ Renamed a Compile() which is called from XmlSchemaCollection and
+ XmlSchemaSet as CompileSubset(). Renamed private Compile() as
+ DoCompile().
+ public Compile() now internally creates a new XmlSchemaSet and
+ compiles the set.
+ * XmlSchemaCollection.cs : now it hooks its schemaSet's validation
+ event handler and thus XmlSchemaSet does not need to check this
+ collection's event handler by itself.
+ XmlSchema.Compile() -> XmlSchema.CompileSubset().
+ * XmlSchemaSet.cs :
+ Removed SchemaCollection which became unneccessary.
+ Added NamedIdentities and IDCollection.
+ XmlSchema.Compile() -> XmlSchema.CompileSubset().
+ * XmlSchemaAttributeGroupRef.cs, XmlSchemaXPath.cs
+ XmlSchemaSimpleTypeList.cs, XmlSchemaComplexContentRestriction.cs,
+ XmlSchemaGroup.cs, XmlSchemaComplexContentExtension.cs,
+ XmlSchemaSequence.cs, XmlSchemaSimpleContentRestriction.cs,
+ XmlSchemaSimpleContentExtension.cs, XmlSchemaAny.cs,
+ XmlSchemaElement.cs, XmlSchemaNotation.cs, XmlSchemaAll.cs,
+ XmlSchemaComplexType.cs, XmlSchemaAnnotation.cs,
+ XmlSchemaAttributeGroup.cs, XmlSchemaSimpleTypeRestriction.cs,
+ XmlSchemaSimpleContent.cs, XmlSchemaGroupRef.cs,
+ XmlSchemaChoice.cs, XmlSchemaSimpleType.cs,
+ XmlSchemaIdentityConstraint.cs, XmlSchemaSimpleTypeUnion.cs,
+ XmlSchemaAnyAttribute.cs, XmlSchemaComplexContent.cs,
+ XmlSchemaAttribute.cs, XmlSchemaObject.cs :
+ removed XmlSchemaObject.IsCompiled(). Check compilation state by
+ comparing compilation ID directly.
+
2006-07-25 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlSchema.cs : mutual schema import was failing because the
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs 2006-07-26
09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs 2006-07-26
10:13:56 UTC (rev 62988)
@@ -65,8 +65,6 @@
private string version;
// other post schema compilation infoset
- private Hashtable idCollection;
- private XmlSchemaObjectTable namedIdentities;
private XmlSchemaSet schemas;
private XmlNameTable nameTable;
@@ -75,7 +73,6 @@
// Only compilation-time use
private XmlSchemaObjectCollection compilationItems;
- private Hashtable handledUris;
// Compiler specific things
const string xmlname = "schema";
@@ -95,8 +92,6 @@
groups = new XmlSchemaObjectTable();
notations = new XmlSchemaObjectTable();
schemaTypes = new XmlSchemaObjectTable();
- idCollection = new Hashtable ();
- namedIdentities = new XmlSchemaObjectTable();
}
#region Properties
@@ -235,20 +230,20 @@
get{ return notations; }
}
- internal Hashtable IDCollection
- {
- get { return idCollection; }
- }
-
internal XmlSchemaObjectTable NamedIdentities
{
- get { return namedIdentities; }
+ get { return schemas.NamedIdentities; }
}
internal XmlSchemaSet Schemas
{
get { return schemas; }
}
+
+ internal Hashtable IDCollection
+ {
+ get { return schemas.IDCollection; }
+ }
#endregion
#region Compile
@@ -284,29 +279,37 @@
internal void Compile (ValidationEventHandler handler,
XmlResolver resolver)
#endif
{
- Compile (handler, new Stack (), this, null, resolver);
+ XmlSchemaSet xss = new XmlSchemaSet ();
+ xss.ValidationEventHandler += handler;
+ xss.XmlResolver = resolver;
+ xss.Add (this);
+ xss.Compile ();
}
- internal void Compile (ValidationEventHandler handler,
XmlSchemaSet col, XmlResolver resolver)
+ // It is used by XmlSchemaCollection.Add(),
+ // XmlSchemaSet.Compile() and XmlSchemaSet.Remove().
+ internal void CompileSubset (ValidationEventHandler handler,
XmlSchemaSet col, XmlResolver resolver)
{
- Compile (handler, new Stack (), this, col, resolver);
+ col.IDCollection.Clear ();
+ col.NamedIdentities.Clear ();
+ Hashtable handledUris = new Hashtable ();
+ // Add this schema itself.
+ if (SourceUri != null && SourceUri.Length > 0)
+ handledUris.Add (SourceUri, SourceUri);
+
+ DoCompile (handler, handledUris, col, resolver);
+
+ Validate (handler);
+
+ if (errorCount == 0)
+ isCompiled = true;
+ errorCount = 0;
}
- private void Compile (ValidationEventHandler handler, Stack
schemaLocationStack, XmlSchema rootSchema, XmlSchemaSet col, XmlResolver
resolver)
+ void DoCompile (ValidationEventHandler handler, Hashtable
handledUris, XmlSchemaSet col, XmlResolver resolver)
{
- if (rootSchema != this) {
- CompilationId = rootSchema.CompilationId;
- schemas = rootSchema.schemas;
- }
- else {
- schemas = col;
- if (schemas == null) {
- schemas = new XmlSchemaSet ();
- schemas.CompilationId = Guid.NewGuid ();
- }
- CompilationId = schemas.CompilationId;
- this.idCollection.Clear ();
- }
+ CompilationId = col.CompilationId;
+ schemas = col;
if (!schemas.Contains (this)) // e.g. xs:import
schemas.Add (this);
@@ -316,7 +319,6 @@
groups.Clear ();
notations.Clear ();
schemaTypes.Clear ();
- namedIdentities.Clear ();
//1. Union and List are not allowed in block default
if (BlockDefault != XmlSchemaDerivationMethod.All) {
@@ -333,7 +335,7 @@
}
//3. id must be of type ID
- XmlSchemaUtil.CompileID(Id, this, this.IDCollection,
handler);
+ XmlSchemaUtil.CompileID(Id, this, col.IDCollection,
handler);
//4. targetNamespace should be of type anyURI or absent
if (TargetNamespace != null) {
@@ -357,12 +359,6 @@
#endif
compilationItems.Add (Items [i]);
}
- if (this == rootSchema) {
- handledUris = new Hashtable ();
- // Add this schema itself.
- if (SourceUri != null && SourceUri.Length > 0)
- handledUris.Add (SourceUri, SourceUri);
- }
// First, we run into inclusion schemas to collect
// compilation target items into compiledItems.
@@ -383,18 +379,10 @@
string url = null;
if (resolver != null) {
url = GetResolvedUri (resolver,
ext.SchemaLocation);
- if (schemaLocationStack.Contains (url))
{
- // Just skip nested inclusion.
- // The spec is "carefully
written"
- // not to handle it as an error.
-// error (handler, "Nested
inclusion was found: " + url);
- // must skip this inclusion
- continue;
- }
- if (rootSchema.handledUris.Contains
(url))
+ if (handledUris.Contains (url))
// This schema is already
handled, so simply skip (otherwise, duplicate definition errrors occur.
continue;
- rootSchema.handledUris.Add (url, url);
+ handledUris.Add (url, url);
try {
stream = resolver.GetEntity
(new Uri (url), null, typeof (Stream)) as Stream;
} catch (Exception) {
@@ -426,7 +414,6 @@
missedSubComponents = true;
continue;
} else {
- schemaLocationStack.Push (url);
XmlTextReader xtr = null;
try {
xtr = new XmlTextReader (url,
stream, nameTable);
@@ -461,12 +448,10 @@
}
// Compile included schema.
- includedSchema.idCollection = this.IDCollection;
- includedSchema.Compile (handler,
schemaLocationStack, rootSchema, col, resolver);
- schemaLocationStack.Pop ();
+ includedSchema.DoCompile (handler, handledUris,
col, resolver);
if (import != null)
- rootSchema.schemas.Add (includedSchema);
+ schemas.Add (includedSchema);
// Note that we use compiled items. Items
// may not exist in Items, since included
@@ -578,13 +563,6 @@
XmlSeverityType.Error);
}
}
-
- if (rootSchema == this)
- Validate(handler);
-
- if (errorCount == 0)
- isCompiled = true;
- errorCount = 0;
}
private string GetResolvedUri (XmlResolver resolver, string
relativeUri)
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -67,7 +67,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
this.schema = schema;
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -79,7 +79,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
this.CompilationId = schema.CompilationId;
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -126,7 +126,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
errorCount = 0;
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -106,7 +106,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
errorCount = 0;
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -250,7 +250,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -110,7 +110,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return errorCount;
errorCount = 0;
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -58,7 +58,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
errorCount = 0;
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -57,7 +57,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
XmlSchemaUtil.CompileID(Id, this, schema.IDCollection,
h);
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -56,6 +56,7 @@
public XmlSchemaCollection (XmlNameTable nameTable)
: this (new XmlSchemaSet (nameTable))
{
+ schemaSet.ValidationEventHandler += new
ValidationEventHandler (OnValidationError);
}
internal XmlSchemaCollection (XmlSchemaSet schemaSet)
@@ -105,7 +106,7 @@
#endif
{
XmlSchema schema = XmlSchema.Read (reader,
ValidationEventHandler);
- schema.Compile (ValidationEventHandler, schemaSet,
resolver);
+ schema.CompileSubset (ValidationEventHandler,
schemaSet, resolver);
lock (schemaSet) {
return schemaSet.Add (schema);
}
@@ -130,7 +131,7 @@
// XmlSchemaCollection.Add() compiles, while
XmlSchemaSet.Add() does not
if (!schema.IsCompiled)
- schema.Compile (ValidationEventHandler,
schemaSet, resolver);
+ schema.CompileSubset (ValidationEventHandler,
schemaSet, resolver);
// compilation error -> returns null (and don't add to
the collection).
if (!schema.IsCompiled)
return null;
@@ -206,7 +207,7 @@
get { return this; }
}
- internal void OnValidationError (object o, ValidationEventArgs
e)
+ void OnValidationError (object o, ValidationEventArgs e)
{
if (ValidationEventHandler != null)
ValidationEventHandler (o, e);
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -65,7 +65,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
===================================================================
---
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -90,7 +90,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
===================================================================
---
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -91,7 +91,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -204,7 +204,7 @@
internal override int Compile (ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return errorCount;
#if NET_2_0
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -350,7 +350,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
InitPostCompileInformations ();
this.schema = schema;
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -86,7 +86,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -84,7 +84,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
this.schema = schema;
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -85,7 +85,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -71,7 +71,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
if(Name == null)
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -149,11 +149,6 @@
return 0;
}
- internal bool IsComplied (Guid compilationId)
- {
- return this.CompilationId == compilationId;
- }
-
internal virtual int Validate (ValidationEventHandler h,
XmlSchema schema)
{
return 0;
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -59,7 +59,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
XmlSchemaUtil.CompileID(Id, this, schema.IDCollection,
h);
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -54,11 +54,12 @@
XmlSchemaObjectTable types;
// XmlSchemaObjectTable attributeGroups;
// XmlSchemaObjectTable groups;
+ Hashtable idCollection;
+ XmlSchemaObjectTable namedIdentities;
XmlSchemaCompilationSettings settings =
new XmlSchemaCompilationSettings ();
- XmlSchemaCollection col;
ValidationEventHandler handler;
bool isCompiled;
@@ -124,20 +125,6 @@
set { settings = value; }
}
- // This is mainly used for event delegating
- internal XmlSchemaCollection SchemaCollection {
- get {
- if (col == null) {
- lock (this) {
- col = new XmlSchemaCollection
();
- foreach (XmlSchema s in schemas)
- col.Add (s);
- }
- }
- return col;
- }
- }
-
public XmlResolver XmlResolver {
set { xmlResolver = value; }
#if NET_2_0
@@ -145,6 +132,22 @@
#endif
}
+ internal Hashtable IDCollection {
+ get {
+ if (idCollection == null)
+ idCollection = new Hashtable ();
+ return idCollection;
+ }
+ }
+
+ internal XmlSchemaObjectTable NamedIdentities {
+ get {
+ if (namedIdentities == null)
+ namedIdentities = new
XmlSchemaObjectTable();
+ return namedIdentities;
+ }
+ }
+
public XmlSchema Add (string targetNamespace, string url)
{
targetNamespace = GetSafeNs (targetNamespace);
@@ -196,7 +199,7 @@
al.AddRange (schemas);
foreach (XmlSchema schema in al) {
if (!schema.IsCompiled)
- schema.Compile (handler, this,
xmlResolver);
+ schema.CompileSubset (handler, this,
xmlResolver);
AddGlobalComponents (schema);
}
isCompiled = true;
@@ -255,8 +258,6 @@
internal void OnValidationError (object o, ValidationEventArgs
e)
{
- if (col != null)
- col.OnValidationError (o, e);
if (ValidationEventHandler != null)
ValidationEventHandler (o, e);
else if (e.Severity == XmlSeverityType.Error)
@@ -275,7 +276,7 @@
// FIXME: I have no idea why Remove() might throw
// XmlSchemaException, except for the case it compiles.
if (!schema.IsCompiled)
- schema.Compile (handler, this, xmlResolver);
+ schema.CompileSubset (handler, this,
xmlResolver);
schemas.Remove (schema);
ResetCompile ();
return schema;
@@ -320,7 +321,7 @@
ClearGlobalComponents ();
foreach (XmlSchema s in al) {
if (schema == s)
- schema.Compile (handler, this,
xmlResolver);
+ schema.CompileSubset (handler, this,
xmlResolver);
if (s.IsCompiled)
AddGlobalComponents (schema);
}
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -57,7 +57,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
if(Content == null)
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
===================================================================
---
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -81,7 +81,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
===================================================================
---
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -103,7 +103,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
if (BaseType != null)
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -249,7 +249,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
if (Content != null)
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -93,7 +93,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
===================================================================
---
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -102,7 +102,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified:
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -78,7 +78,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
#if NET_2_0
Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
2006-07-26 09:44:21 UTC (rev 62987)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
2006-07-26 10:13:56 UTC (rev 62988)
@@ -57,7 +57,7 @@
internal override int Compile(ValidationEventHandler h,
XmlSchema schema)
{
// If this is already compiled this time, simply skip.
- if (this.IsComplied (schema.CompilationId))
+ if (CompilationId == schema.CompilationId)
return 0;
if (nsmgr == null) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches