本文整理匯總了C#中System.Xml.Schema.XmlSchema.CompileSchema方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSchema.CompileSchema方法的具體用法?C# XmlSchema.CompileSchema怎麽用?C# XmlSchema.CompileSchema使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.Schema.XmlSchema
的用法示例。
在下文中一共展示了XmlSchema.CompileSchema方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Add
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;
}
示例2: Add
private XmlSchema Add(string ns, SchemaInfo schemaInfo, XmlSchema schema, bool compile, System.Xml.XmlResolver resolver)
{
int num = 0;
if (schema != null)
{
if ((schema.ErrorCount == 0) && compile)
{
if (!schema.CompileSchema(this, resolver, schemaInfo, ns, this.validationEventHandler, this.nameTable, true))
{
num = 1;
}
ns = (schema.TargetNamespace == null) ? string.Empty : schema.TargetNamespace;
}
num += schema.ErrorCount;
}
else
{
num += schemaInfo.ErrorCount;
ns = this.NameTable.Add(ns);
}
if (num == 0)
{
XmlSchemaCollectionNode node = new XmlSchemaCollectionNode {
NamespaceURI = ns,
SchemaInfo = schemaInfo,
Schema = schema
};
this.Add(ns, node);
return schema;
}
return null;
}