本文整理匯總了C#中System.Xml.Schema.XmlSchemaObjectTable.Insert方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSchemaObjectTable.Insert方法的具體用法?C# XmlSchemaObjectTable.Insert怎麽用?C# XmlSchemaObjectTable.Insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.Schema.XmlSchemaObjectTable
的用法示例。
在下文中一共展示了XmlSchemaObjectTable.Insert方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddToTable
private bool AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item) {
if (qname.Name.Length == 0) {
return true;
}
XmlSchemaObject existingObject = (XmlSchemaObject)table[qname];
if (existingObject != null) {
if (existingObject == item || existingObject.SourceUri == item.SourceUri) {
return true;
}
string code = string.Empty;
if (item is XmlSchemaComplexType) {
code = Res.Sch_DupComplexType;
}
else if (item is XmlSchemaSimpleType) {
code = Res.Sch_DupSimpleType;
}
else if (item is XmlSchemaElement) {
code = Res.Sch_DupGlobalElement;
}
else if (item is XmlSchemaAttribute) {
if (qname.Namespace == XmlReservedNs.NsXml) {
XmlSchema schemaForXmlNS = Preprocessor.GetBuildInSchema();
XmlSchemaObject builtInAttribute = schemaForXmlNS.Attributes[qname];
if (existingObject == builtInAttribute) { //replace built-in one
table.Insert(qname, item);
return true;
}
else if (item == builtInAttribute) { //trying to overwrite customer's component with built-in, ignore built-in
return true;
}
}
code = Res.Sch_DupGlobalAttribute;
}
SendValidationEvent(new XmlSchemaException(code,qname.ToString()), XmlSeverityType.Error);
return false;
}
else {
table.Add(qname, item);
return true;
}
}
示例2: IsValidTypeRedefine
private bool IsValidTypeRedefine(XmlSchemaObject existingObject, XmlSchemaObject item, XmlSchemaObjectTable table)
{
XmlSchemaType type = item as XmlSchemaType;
XmlSchemaType type2 = existingObject as XmlSchemaType;
if (type2 == type.Redefined)
{
if (type2.ElementDecl == null)
{
table.Insert(type.QualifiedName, type);
return true;
}
}
else if (type2.Redefined == type)
{
return true;
}
return false;
}
示例3: AddToTable
protected void AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item)
{
if (qname.Name.Length != 0)
{
XmlSchemaObject existingObject = table[qname];
if (existingObject != null)
{
if (existingObject != item)
{
string code = "Sch_DupGlobalElement";
if (item is XmlSchemaAttributeGroup)
{
if (Ref.Equal(this.nameTable.Add(qname.Namespace), this.NsXml))
{
XmlSchemaObject obj3 = Preprocessor.GetBuildInSchema().AttributeGroups[qname];
if (existingObject == obj3)
{
table.Insert(qname, item);
return;
}
if (item == obj3)
{
return;
}
}
else if (this.IsValidAttributeGroupRedefine(existingObject, item, table))
{
return;
}
code = "Sch_DupAttributeGroup";
}
else if (item is XmlSchemaAttribute)
{
if (Ref.Equal(this.nameTable.Add(qname.Namespace), this.NsXml))
{
XmlSchemaObject obj4 = Preprocessor.GetBuildInSchema().Attributes[qname];
if (existingObject == obj4)
{
table.Insert(qname, item);
return;
}
if (item == obj4)
{
return;
}
}
code = "Sch_DupGlobalAttribute";
}
else if (item is XmlSchemaSimpleType)
{
if (this.IsValidTypeRedefine(existingObject, item, table))
{
return;
}
code = "Sch_DupSimpleType";
}
else if (item is XmlSchemaComplexType)
{
if (this.IsValidTypeRedefine(existingObject, item, table))
{
return;
}
code = "Sch_DupComplexType";
}
else if (item is XmlSchemaGroup)
{
if (this.IsValidGroupRedefine(existingObject, item, table))
{
return;
}
code = "Sch_DupGroup";
}
else if (item is XmlSchemaNotation)
{
code = "Sch_DupNotation";
}
else if (item is XmlSchemaIdentityConstraint)
{
code = "Sch_DupIdentityConstraint";
}
this.SendValidationEvent(code, qname.ToString(), item);
}
}
else
{
table.Add(qname, item);
}
}
}
示例4: IsValidAttributeGroupRedefine
private bool IsValidAttributeGroupRedefine(XmlSchemaObject existingObject, XmlSchemaObject item, XmlSchemaObjectTable table)
{
XmlSchemaAttributeGroup group = item as XmlSchemaAttributeGroup;
XmlSchemaAttributeGroup group2 = existingObject as XmlSchemaAttributeGroup;
if (group2 == group.Redefined)
{
if (group2.AttributeUses.Count == 0)
{
table.Insert(group.QualifiedName, group);
return true;
}
}
else if (group2.Redefined == group)
{
return true;
}
return false;
}
示例5: IsValidGroupRedefine
private bool IsValidGroupRedefine(XmlSchemaObject existingObject, XmlSchemaObject item, XmlSchemaObjectTable table)
{
XmlSchemaGroup group = item as XmlSchemaGroup;
XmlSchemaGroup group2 = existingObject as XmlSchemaGroup;
if (group2 == group.Redefined)
{
if (group2.CanonicalParticle == null)
{
table.Insert(group.QualifiedName, group);
return true;
}
}
else if (group2.Redefined == group)
{
return true;
}
return false;
}
示例6: AddToTable
protected void AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item) {
if (qname.Name.Length == 0) {
return;
}
XmlSchemaObject existingObject = (XmlSchemaObject)table[qname];
if (existingObject != null) {
if (existingObject == item) {
return;
}
string code = Res.Sch_DupGlobalElement;
if (item is XmlSchemaAttributeGroup) {
string ns = nameTable.Add(qname.Namespace);
if (Ref.Equal(ns, NsXml)) { //Check for xml namespace
XmlSchema schemaForXmlNS = Preprocessor.GetBuildInSchema();
XmlSchemaObject builtInAttributeGroup = schemaForXmlNS.AttributeGroups[qname];
if ((object)existingObject == (object)builtInAttributeGroup) {
table.Insert(qname, item);
return;
}
else if ((object)item == (object)builtInAttributeGroup) { //trying to overwrite customer's component with built-in, ignore built-in
return;
}
}
else if (IsValidAttributeGroupRedefine(existingObject, item, table)){ //check for redefines
return;
}
code = Res.Sch_DupAttributeGroup;
}
else if (item is XmlSchemaAttribute) {
string ns = nameTable.Add(qname.Namespace);
if (Ref.Equal(ns, NsXml)) {
XmlSchema schemaForXmlNS = Preprocessor.GetBuildInSchema();
XmlSchemaObject builtInAttribute = schemaForXmlNS.Attributes[qname];
if ((object)existingObject == (object)builtInAttribute) { //replace built-in one
table.Insert(qname, item);
return;
}
else if ((object)item == (object)builtInAttribute) { //trying to overwrite customer's component with built-in, ignore built-in
return;
}
}
code = Res.Sch_DupGlobalAttribute;
}
else if (item is XmlSchemaSimpleType) {
if (IsValidTypeRedefine(existingObject, item, table)) {
return;
}
code = Res.Sch_DupSimpleType;
}
else if (item is XmlSchemaComplexType) {
if (IsValidTypeRedefine(existingObject, item, table)) {
return;
}
code = Res.Sch_DupComplexType;
}
else if (item is XmlSchemaGroup) {
if (IsValidGroupRedefine(existingObject, item, table)){ //check for redefines
return;
}
code = Res.Sch_DupGroup;
}
else if (item is XmlSchemaNotation) {
code = Res.Sch_DupNotation;
}
else if (item is XmlSchemaIdentityConstraint) {
code = Res.Sch_DupIdentityConstraint;
}
else {
Debug.Assert(item is XmlSchemaElement);
}
SendValidationEvent(code, qname.ToString(), item);
}
else {
table.Add(qname, item);
}
}
示例7: IsValidTypeRedefine
private bool IsValidTypeRedefine(XmlSchemaObject existingObject, XmlSchemaObject item, XmlSchemaObjectTable table) {
XmlSchemaType schemaType = item as XmlSchemaType;
XmlSchemaType existingType = existingObject as XmlSchemaType;
if (existingType == schemaType.Redefined) { //schemaType is the redefinition of existingObject
if (existingType.ElementDecl == null) { //If the existing one is not already compiled, then replace.
table.Insert(schemaType.QualifiedName, schemaType); //Update with redefined entry
return true;
}
}
else if (existingType.Redefined == schemaType) { //Redefined type already exists in the set, original type is added after redefined type, ignore the original type
return true;
}
return false;
}
示例8: IsValidGroupRedefine
private bool IsValidGroupRedefine(XmlSchemaObject existingObject, XmlSchemaObject item, XmlSchemaObjectTable table) {
XmlSchemaGroup group = item as XmlSchemaGroup;
XmlSchemaGroup existingGroup = existingObject as XmlSchemaGroup;
if (existingGroup == group.Redefined) { //group is the redefinition of existingObject
if (existingGroup.CanonicalParticle == null) { //If the existing one is not already compiled, then replace.
table.Insert(group.QualifiedName, group); //Update with redefined entry
return true;
}
}
else if (existingGroup.Redefined == group) { //Redefined type already exists in the set, original type is added after redefined type, ignore the original type
return true;
}
return false;
}
示例9: IsValidAttributeGroupRedefine
private bool IsValidAttributeGroupRedefine(XmlSchemaObject existingObject, XmlSchemaObject item, XmlSchemaObjectTable table) {
XmlSchemaAttributeGroup attGroup = item as XmlSchemaAttributeGroup;
XmlSchemaAttributeGroup existingAttGroup = existingObject as XmlSchemaAttributeGroup;
if (existingAttGroup == attGroup.Redefined) { //attribute group is the redefinition of existingObject
if (existingAttGroup.AttributeUses.Count == 0) { //If the existing one is not already compiled, then replace.
table.Insert(attGroup.QualifiedName, attGroup); //Update with redefined entry
return true;
}
}
else if (existingAttGroup.Redefined == attGroup) { //Redefined type already exists in the set, original type is added after redefined type, ignore the original type
return true;
}
return false;
}
示例10: AddToTable
private bool AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item)
{
if (qname.Name.Length != 0)
{
XmlSchemaObject obj2 = table[qname];
if (obj2 != null)
{
if ((obj2 == item) || (obj2.SourceUri == item.SourceUri))
{
return true;
}
string res = string.Empty;
if (item is XmlSchemaComplexType)
{
res = "Sch_DupComplexType";
}
else if (item is XmlSchemaSimpleType)
{
res = "Sch_DupSimpleType";
}
else if (item is XmlSchemaElement)
{
res = "Sch_DupGlobalElement";
}
else if (item is XmlSchemaAttribute)
{
if (qname.Namespace == "http://www.w3.org/XML/1998/namespace")
{
XmlSchemaObject obj3 = Preprocessor.GetBuildInSchema().Attributes[qname];
if (obj2 == obj3)
{
table.Insert(qname, item);
return true;
}
if (item == obj3)
{
return true;
}
}
res = "Sch_DupGlobalAttribute";
}
this.SendValidationEvent(new XmlSchemaException(res, qname.ToString()), XmlSeverityType.Error);
return false;
}
table.Add(qname, item);
}
return true;
}