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); }
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); }
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); }
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); }
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); }
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); }
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); }
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; }
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; } }
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); } } }
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; }
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; }
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; }
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; }
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; }
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; }
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)) //check for redefines { table.Insert(qname, item); 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.Insert(qname, item); return; } code = Res.Sch_DupSimpleType; } else if (item is XmlSchemaComplexType) { if (IsValidTypeRedefine(existingObject, item)) { table.Insert(qname, item); return; } code = Res.Sch_DupComplexType; } else if (item is XmlSchemaGroup) { if (IsValidGroupRedefine(existingObject, item)) //check for redefines { table.Insert(qname, item); 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); } }
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); } }