public XmlSchemaCollection (XmlNameTable nameTable)
: this (new XmlSchemaSet (nameTable))
{
+ schemaSet.ValidationEventHandler += new ValidationEventHandler (OnValidationError);
}
internal XmlSchemaCollection (XmlSchemaSet schemaSet)
#endif
{
XmlSchema schema = XmlSchema.Read (reader, ValidationEventHandler);
- schema.Compile (ValidationEventHandler, schemaSet, resolver);
+ schema.CompileSubset (ValidationEventHandler, schemaSet, resolver);
lock (schemaSet) {
return schemaSet.Add (schema);
}
// 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;
- string ns = GetSafeNs (schema.TargetNamespace);
lock (schemaSet) {
// consider imported schemas.
schemaSet.Add (schema.Schemas);
}
}
- private string GetSafeNs (string ns)
- {
- return ns != null ? ns : String.Empty;
- }
-
public void Add (XmlSchemaCollection schema)
{
if (schema == null)
public XmlSchemaCollectionEnumerator GetEnumerator ()
{
- return new XmlSchemaCollectionEnumerator (this);
+ // The actual collection is schemaSet.Schemas()
+ return new XmlSchemaCollectionEnumerator(schemaSet.Schemas());
+ }
+
+ int ICollection.Count {
+ get { return Count; }
}
// interface Methods
get { return this; }
}
- internal void OnValidationError (object o, ValidationEventArgs e)
+ void OnValidationError (object o, ValidationEventArgs e)
{
if (ValidationEventHandler != null)
ValidationEventHandler (o, e);