private Add ( string ns, |
||
ns | string | |
schemaInfo | ||
schema | ||
compile | bool | |
resolver | ||
return |
private XmlSchema Add(string ns, SchemaInfo schemaInfo, XmlSchema schema, bool compile, XmlResolver resolver)
{
int errorCount = 0;
if (schema != null)
{
if (schema.ErrorCount == 0 && compile)
{
if (!schema.CompileSchema(this, resolver, schemaInfo, ns, _validationEventHandler, _nameTable, true))
{
errorCount = 1;
}
ns = schema.TargetNamespace == null ? string.Empty : schema.TargetNamespace;
}
errorCount += schema.ErrorCount;
}
else
{
errorCount += schemaInfo.ErrorCount;
//ns = ns == null? string.Empty : NameTable.Add(ns);
ns = NameTable.Add(ns); //Added without checking for ns == null, since XDR cannot have null namespace
}
if (errorCount == 0)
{
XmlSchemaCollectionNode node = new XmlSchemaCollectionNode();
node.NamespaceURI = ns;
node.SchemaInfo = schemaInfo;
node.Schema = schema;
Add(ns, node);
return schema;
}
return null;
}
XmlSchemaCollection::Add ( String ns, |
|
XmlSchemaCollection::Add ( String ns, |
|
XmlSchemaCollection::Add ( |
|
XmlSchemaCollection::Add ( |
|
XmlSchemaCollection::Add ( string ns, |
|
XmlSchemaCollection::Add ( string ns, string uri ) : |
|
XmlSchemaCollection::Add ( |
|
XmlSchemaCollection::Add ( string ns, |
public void TestAdd () { XmlSchemaCollection col = new XmlSchemaCollection (); XmlSchema schema = new XmlSchema (); XmlSchemaElement elem = new XmlSchemaElement (); elem.Name = "foo"; schema.Items.Add (elem); schema.TargetNamespace = "urn:foo"; col.Add (schema); col.Add (schema); // No problem !? XmlSchema schema2 = new XmlSchema (); schema2.Items.Add (elem); schema2.TargetNamespace = "urn:foo"; col.Add (schema2); // No problem !! schema.Compile (null); col.Add (schema); col.Add (schema); // Still no problem !!! schema2.Compile (null); col.Add (schema2); schema = GetSchema ("Test/XmlFiles/xsd/3.xsd"); schema.Compile (null); col.Add (schema); schema2 = GetSchema ("Test/XmlFiles/xsd/3.xsd"); schema2.Compile (null); col.Add (schema2); }