本文整理汇总了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;
}