Adds all the XML Schema definition language (XSD) schemas in the given System.Xml.Schema.XmlSchemaSet to the System.Xml.Schema.XmlSchemaSet.
- schemas
- The System.Xml.Schema.XmlSchemaSet object.
Before a schema can be added to an System.Xml.Schema.XmlSchemaSet, it has to be successfully preprocessed. Preprocessing performs the following basic tasks.
[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]If the XmlSchemaSet.IsCompiled property of the System.Xml.Schema.XmlSchemaSet to add is true, all schemas in the System.Xml.Schema.XmlSchemaSet to add are added to the System.Xml.Schema.XmlSchemaSet. If the XmlSchemaSet.IsCompiled property of the System.Xml.Schema.XmlSchemaSet to add is false, each schema added is preprocessed before being added. If any of the schemas in the newly added System.Xml.Schema.XmlSchemaSet fails to be preprocessed, no schemas are added; instead, an System.Xml.Schema.XmlSchemaException is thrown. As a result, the following two code example are not equivalent.
Example
' First example schemaSet.Add(schemaSet1) ' Second example Dim schema As XmlSchema For Each schema in schemaSet.Schemas() schemaSet.Add(schema) Next
Example
// First example schemaSet.Add(schemaSet1); // Second example foreach(XmlSchema schema in schemaSet.Schemas()) { schemaSet.Add(schema); }
The previous two code examples are not equivalent. In the first example, if an invalid schema exists in schemaSet1 and its XmlSchemaSet.IsCompiled property is set to false, no schemas are added to schemaSet. In the second example, a number of schemas can be added to schemaSet before an invalid schema is encountered and an exception is thrown.