本文整理汇总了C#中System.Xml.Schema.XmlSchemaObjectTable.Add方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaObjectTable.Add方法的具体用法?C# XmlSchemaObjectTable.Add怎么用?C# XmlSchemaObjectTable.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XmlSchemaObjectTable
的用法示例。
在下文中一共展示了XmlSchemaObjectTable.Add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
示例2: 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;
}
}
示例3: AddToTable
private void AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item) {
if (qname.Name == string.Empty) {
return;
}
else if (table[qname] != null) {
string code = Res.Sch_DupGlobalAttribute;
if (item is XmlSchemaAttributeGroup) {
code = Res.Sch_DupAttributeGroup;
}
else 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 XmlSchemaGroup) {
code = Res.Sch_DupGroup;
}
else if (item is XmlSchemaNotation) {
code = Res.Sch_DupNotation;
}
SendValidationEvent(code, qname.ToString(), item);
}
else {
table.Add(qname, item);
}
}
示例4: 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);
}
}
示例5: 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;
}
示例6: ValidateUniqueTypeAttribution
internal override void ValidateUniqueTypeAttribution (XmlSchemaObjectTable labels,
ValidationEventHandler h, XmlSchema schema)
{
XmlSchemaElement labeled = labels [this.QualifiedName] as XmlSchemaElement;
if (labeled == null)
labels.Add (this.QualifiedName, this);
else if (labeled.ElementType != this.ElementType)
error (h, "Different types are specified on the same named elements in the same sequence. Element name is " + QualifiedName);
}
示例7: ValidateUniqueParticleAttribution
internal override void ValidateUniqueParticleAttribution (XmlSchemaObjectTable qnames, ArrayList nsNames,
ValidationEventHandler h, XmlSchema schema)
{
if (qnames.Contains (this.QualifiedName))// && !this.ParticleEquals ((XmlSchemaParticle) qnames [this.QualifiedName]))
error (h, "Ambiguous element label was detected: " + this.QualifiedName);
else {
foreach (XmlSchemaAny any in nsNames) {
if (any.ValidatedMaxOccurs == 0)
continue;
if (any.HasValueAny ||
any.HasValueLocal && this.QualifiedName.Namespace == "" ||
any.HasValueOther && this.QualifiedName.Namespace != this.QualifiedName.Namespace ||
any.HasValueTargetNamespace && this.QualifiedName.Namespace == this.QualifiedName.Namespace) {
error (h, "Ambiguous element label which is contained by -any- particle was detected: " + this.QualifiedName);
break;
} else if (!any.HasValueOther) {
bool bad = false;
foreach (string ns in any.ResolvedNamespaces) {
if (ns == this.QualifiedName.Namespace) {
bad = true;
break;
}
}
if (bad) {
error (h, "Ambiguous element label which is contained by -any- particle was detected: " + this.QualifiedName);
break;
}
} else {
if (any.TargetNamespace != this.QualifiedName.Namespace)
error (h, String.Format ("Ambiguous element label '{0}' which is contained by -any- particle with ##other value than '{1}' was detected: ", this.QualifiedName.Namespace, any.TargetNamespace));
}
}
qnames.Add (this.QualifiedName, this);
}
}