• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Schema.XmlSchemaAttribute类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Schema.XmlSchemaAttribute的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaAttribute类的具体用法?C# XmlSchemaAttribute怎么用?C# XmlSchemaAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlSchemaAttribute类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaAttribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BuildAttribute

        protected void BuildAttribute( XmlSchemaAttribute attribute,
                                       ObjectDef objectDef )
        {
            FieldDef def = null;
            bool isEnum;
            string dataType =
                GetClassTypeFromDataType
                    ( attribute.AttributeSchemaType, attribute.QualifiedName.Name, objectDef.Name,
                      out isEnum );
            if ( isEnum ) {
                def = objectDef.DefineAttr( attribute.QualifiedName.Name, null );
                def.SetEnum( dataType );
            }
            else {
                def = objectDef.DefineAttr( attribute.QualifiedName.Name, dataType );
            }

            if ( attribute.Use == XmlSchemaUse.Required ) {
                def.SetFlags( "R" );
            }
            else {
                def.SetFlags( "O" );
            }
            setAnnotation( def, attribute.Annotation );
            // TODO: See if the data type is an enumeration
            //System.Diagnostics.Debug.Assert( ! ( attribute.AttributeType is xmlschemdata
        }
开发者ID:rafidzal,项目名称:OpenADK-csharp,代码行数:27,代码来源:SifSchema.cs


示例2: AttributeForm

 private XmlSchemaForm AttributeForm(string ns, XmlSchemaAttribute attribute)
 {
     if (attribute.Form != XmlSchemaForm.None)
     {
         return attribute.Form;
     }
     XmlSchemaObject parent = attribute;
     while (parent.Parent != null)
     {
         parent = parent.Parent;
     }
     XmlSchema schema = parent as XmlSchema;
     if (schema != null)
     {
         if ((ns == null) || (ns.Length == 0))
         {
             if (schema.AttributeFormDefault != XmlSchemaForm.None)
             {
                 return schema.AttributeFormDefault;
             }
             return XmlSchemaForm.Unqualified;
         }
         XmlSchemas.Preprocess(schema);
         if ((attribute.QualifiedName.Namespace != null) && (attribute.QualifiedName.Namespace.Length != 0))
         {
             return XmlSchemaForm.Qualified;
         }
     }
     return XmlSchemaForm.Unqualified;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:XmlSchemaImporter.cs


示例3: AndSchema

		public static XmlSchemaElement AndSchema()
		{
			var type = new XmlSchemaComplexType();

			var any = new XmlSchemaAny();
			any.MinOccurs = 1;
			any.MaxOccursString = "unbounded";
			any.ProcessContents = XmlSchemaContentProcessing.Strict;
			any.Namespace = "##local";

			var sequence = new XmlSchemaSequence();
			type.Particle = sequence;
			sequence.Items.Add(any);

			var attrib = new XmlSchemaAttribute();
			attrib.Name = "expressionLanguage";
			attrib.Use = XmlSchemaUse.Optional;
			attrib.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
			type.Attributes.Add(attrib);

			attrib = new XmlSchemaAttribute();
			attrib.Name = "failMessage";
			attrib.Use = XmlSchemaUse.Optional;
			attrib.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
			type.Attributes.Add(attrib);

			var element = new XmlSchemaElement();
			element.Name = "and";
			element.SchemaType = type;

			return element;
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:32,代码来源:XmlSpecificationSchema.cs


示例4: ReplaceThisWith

 public static void ReplaceThisWith(this XmlSchemaAttribute that, XmlSchemaAttribute with) 
 {
     var gr = that.Parent as XmlSchemaComplexType;
     int idx = gr.Attributes.IndexOf(that);
     gr.Attributes.Insert(idx, with);
     gr.Attributes.Remove(that);
 }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:7,代码来源:DmlExtensions.cs


示例5: FixtureInit

		public override void FixtureInit()
		{
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			schemas.Add(SchemaCompletionData);
			XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, SchemaCompletionData, String.Empty);
			string xml = "<note xmlns='http://www.w3schools.com' name=''></note>";
			schemaAttribute = (XmlSchemaAttribute)XmlView.GetSchemaObjectSelected(xml, xml.IndexOf("name"), provider);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:8,代码来源:AttributeSelectedTestFixture.cs


示例6: Visit

        protected override void Visit(XmlSchemaAttribute attribute)
        {
            if (!attribute.RefName.IsEmpty ||
                attribute.Use == XmlSchemaUse.Prohibited)
                return;

            AddTopic(TopicType.Attribute, attribute.QualifiedName.Namespace, attribute, attribute.Name);
        }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:8,代码来源:TopicBuilder.cs


示例7: FixtureInit

		public override void FixtureInit()
		{
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			schemas.Add(SchemaCompletion);
			string xml = "<note xmlns='http://www.w3schools.com' name=''></note>";
			XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, null);
			schemaAttribute = (XmlSchemaAttribute)schemaDefinition.GetSelectedSchemaObject(xml, xml.IndexOf("name"));
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:8,代码来源:AttributeSelectedTestFixture.cs


示例8: Visit

        protected override void Visit(XmlSchemaAttribute attribute)
        {
            if (!attribute.RefName.IsEmpty)
                return;

            PushNamedObject(attribute);
            base.Visit(attribute);
            PopNamedObject();
        }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:9,代码来源:TypeUsageFinder.cs


示例9: FixtureInit

		public override void FixtureInit()
		{
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			schemas.Add(SchemaCompletion);
			XmlSchemaCompletion xsdSchemaCompletionData = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
			schemas.Add(xsdSchemaCompletionData);
			
			string xml = GetSchema();			
			int index = xml.IndexOf("ref=\"dir\"");
			index = xml.IndexOf("dir", index);
			XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);
			schemaAttribute = (XmlSchemaAttribute)schemaDefinition.GetSelectedSchemaObject(xml, index);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:13,代码来源:AttributeReferenceSelectedTestFixture.cs


示例10: FixtureInit

		public override void FixtureInit()
		{
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			schemas.Add(SchemaCompletionData);
			XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
			schemas.Add(xsdSchemaCompletionData);
			XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
			
			string xml = GetSchema();			
			int index = xml.IndexOf("ref=\"dir\"");
			index = xml.IndexOf("dir", index);
			schemaAttribute = (XmlSchemaAttribute)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:13,代码来源:AttributeReferenceSelectedTestFixture.cs


示例11: FixtureInit

		public override void FixtureInit()
		{
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			schemas.Add(SchemaCompletionData);
			XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
			schemas.Add(xsdSchemaCompletionData);
			XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty, null);
			
			string xml = GetSchema();
			schemaAttribute = (XmlSchemaAttribute)XmlEditorView.GetSchemaObjectSelected(xml, xml.IndexOf("ref=\"name"), provider, SchemaCompletionData);
			
			int index = xml.IndexOf("ref=\"name");
			index = xml.IndexOf('n', index);
			referencedSchemaElement = (XmlSchemaElement)XmlEditorView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:15,代码来源:ElementReferenceSelectedTestFixture.cs


示例12: GetDataSchemas

        public XmlSchema GetDataSchemas(XmlSchema querySchema,IEnumerable<Registration> registrations)
        {
            var schema = new XmlSchema { TargetNamespace = RegistrationStorage.Dataspace };
            schema.Namespaces.Add("", RegistrationStorage.Dataspace);
            var guid = CreateGuidType();
            schema.Items.Add(guid);
            schema.Includes.Add(new XmlSchemaImport { Schema = querySchema, Namespace = querySchema.TargetNamespace });
            foreach (var registration in registrations)
            {
                var etype = new XmlSchemaComplexType
                {
                    Name = registration.ResourceName,
                    Annotation = new XmlSchemaAnnotation()
                };
                var doc = new XmlSchemaDocumentation { Markup = TextToNode(registration.ResourceType.FullName) };
                etype.Annotation.Items.Add(doc);
                etype.Block = XmlSchemaDerivationMethod.Extension;
                var idAttr = new XmlSchemaAttribute
                {
                    Name = "Id",
                    SchemaTypeName = new XmlQualifiedName(guid.Name, RegistrationStorage.Dataspace),
                    Use = XmlSchemaUse.Required
                };
                etype.Attributes.Add(idAttr);
                var noChildrenAttr = new XmlSchemaAttribute
                {
                    Name = RegistrationStorage.DefinitlyNoChildren,
                    SchemaType = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Boolean),
                    Use = XmlSchemaUse.Optional
                };
                etype.Attributes.Add(noChildrenAttr);
                if (querySchema.Items.OfType<XmlSchemaAttributeGroup>().Any(k => k.Name == etype.Name))
                {

                    var group = new XmlSchemaAttributeGroupRef();
                    group.RefName = new XmlQualifiedName(etype.Name.Replace(" ", "_"), querySchema.TargetNamespace);
                    etype.Attributes.Add(group);

                }
                schema.Items.Add(etype);
            }

            return schema;
        }
开发者ID:kayanme,项目名称:Dataspace,代码行数:44,代码来源:DataSchemaBuilder.cs


示例13: AddAttribute

		public void AddAttribute (XmlSchemaAttribute attribute)
		{
			string name = attribute.Name;
			if (name == null) {
				var ns = attribute.RefName.Namespace;
				if (string.IsNullOrEmpty (ns))
					return;
				var prefix = nsMap.GetPrefix (ns);
				if (prefix == null) {
					if (ns == "http://www.w3.org/XML/1998/namespace")
						prefix = "xml";
					else
						return;
				}
				name = attribute.RefName.Name;
				if (prefix.Length > 0)
					name = prefix + ":" + name;
			}
			if (!names.Add (name))
				return;
			string documentation = GetDocumentation (attribute.Annotation);
			Add (new XmlCompletionData (name, documentation, XmlCompletionData.DataType.XmlAttribute));
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:23,代码来源:XmlCompletionDataList.cs


示例14: VisitXmlSchemaAttribute

        public virtual void VisitXmlSchemaAttribute(XmlSchemaAttribute attribute)
        {
            Dispatch(attribute.AttributeSchemaType);

            // why there is no pattern mathing in C# ???

            if(attribute.Parent is XmlSchemaComplexType)
            {
                XmlSchemaComplexType complexType = (XmlSchemaComplexType) attribute.Parent;

                VisitXmlSchemaAttribute(complexType, attribute);
            }
            else if (attribute.Parent is XmlSchemaAttributeGroup)
            {
                XmlSchemaAttributeGroup attributeGroup = (XmlSchemaAttributeGroup)attribute.Parent;

                VisitXmlSchemaAttribute(attributeGroup, attribute);
            }
            else
            {
                Assert.Fail(attribute.Parent.GetType().ToString());
            }
        }
开发者ID:willrawls,项目名称:arp,代码行数:23,代码来源:XsdVisitor.cs


示例15: GetBuildInSchema

 internal static XmlSchema GetBuildInSchema()
 {
     if (builtInSchemaForXmlNS == null)
     {
         XmlSchema schema = new XmlSchema {
             TargetNamespace = "http://www.w3.org/XML/1998/namespace"
         };
         schema.Namespaces.Add("xml", "http://www.w3.org/XML/1998/namespace");
         XmlSchemaAttribute item = new XmlSchemaAttribute {
             Name = "lang",
             SchemaTypeName = new XmlQualifiedName("language", "http://www.w3.org/2001/XMLSchema")
         };
         schema.Items.Add(item);
         XmlSchemaAttribute attribute2 = new XmlSchemaAttribute {
             Name = "base",
             SchemaTypeName = new XmlQualifiedName("anyURI", "http://www.w3.org/2001/XMLSchema")
         };
         schema.Items.Add(attribute2);
         XmlSchemaAttribute attribute3 = new XmlSchemaAttribute {
             Name = "space"
         };
         XmlSchemaSimpleType type = new XmlSchemaSimpleType();
         XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction {
             BaseTypeName = new XmlQualifiedName("NCName", "http://www.w3.org/2001/XMLSchema")
         };
         XmlSchemaEnumerationFacet facet = new XmlSchemaEnumerationFacet {
             Value = "default"
         };
         restriction.Facets.Add(facet);
         XmlSchemaEnumerationFacet facet2 = new XmlSchemaEnumerationFacet {
             Value = "preserve"
         };
         restriction.Facets.Add(facet2);
         type.Content = restriction;
         attribute3.SchemaType = type;
         attribute3.DefaultValue = "preserve";
         schema.Items.Add(attribute3);
         XmlSchemaAttributeGroup group = new XmlSchemaAttributeGroup {
             Name = "specialAttrs"
         };
         XmlSchemaAttribute attribute4 = new XmlSchemaAttribute {
             RefName = new XmlQualifiedName("lang", "http://www.w3.org/XML/1998/namespace")
         };
         group.Attributes.Add(attribute4);
         XmlSchemaAttribute attribute5 = new XmlSchemaAttribute {
             RefName = new XmlQualifiedName("space", "http://www.w3.org/XML/1998/namespace")
         };
         group.Attributes.Add(attribute5);
         XmlSchemaAttribute attribute6 = new XmlSchemaAttribute {
             RefName = new XmlQualifiedName("base", "http://www.w3.org/XML/1998/namespace")
         };
         group.Attributes.Add(attribute6);
         schema.Items.Add(group);
         schema.IsPreprocessed = true;
         schema.CompileSchemaInSet(new NameTable(), null, null);
         Interlocked.CompareExchange<XmlSchema>(ref builtInSchemaForXmlNS, schema, null);
     }
     return builtInSchemaForXmlNS;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:59,代码来源:Preprocessor.cs


示例16: PreprocessLocalAttribute

 private void PreprocessLocalAttribute(XmlSchemaAttribute attribute)
 {
     if (attribute.Name != null)
     {
         this.ValidateNameAttribute(attribute);
         this.PreprocessAttributeContent(attribute);
         attribute.SetQualifiedName(new XmlQualifiedName(attribute.Name, ((attribute.Form == XmlSchemaForm.Qualified) || ((attribute.Form == XmlSchemaForm.None) && (this.attributeFormDefault == XmlSchemaForm.Qualified))) ? this.targetNamespace : null));
     }
     else
     {
         this.PreprocessAnnotation(attribute);
         if (attribute.RefName.IsEmpty)
         {
             base.SendValidationEvent("Sch_AttributeNameRef", "???", attribute);
         }
         else
         {
             this.ValidateQNameAttribute(attribute, "ref", attribute.RefName);
         }
         if ((!attribute.SchemaTypeName.IsEmpty || (attribute.SchemaType != null)) || (attribute.Form != XmlSchemaForm.None))
         {
             base.SendValidationEvent("Sch_InvalidAttributeRef", attribute);
         }
         attribute.SetQualifiedName(attribute.RefName);
     }
     this.ValidateIdAttribute(attribute);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:Preprocessor.cs


示例17: GetSchemaObjectReferenced

		/// <summary>
		/// If the attribute value found references another item in the schema
		/// return this instead of the attribute schema object. For example, if the
		/// user can select the attribute value and the code will work out the schema object pointed to by the ref
		/// or type attribute:
		///
		/// xs:element ref="ref-name"
		/// xs:attribute type="type-name"
		/// </summary>
		/// <returns>
		/// The <paramref name="attribute"/> if no schema object was referenced.
		/// </returns>
		XmlSchemaObject GetSchemaObjectReferenced (XmlSchemaCompletionData currentSchemaCompletionData, XmlSchemaElement element, XmlSchemaAttribute attribute)
		{
			XmlSchemaObject schemaObject = null;
			if (IsXmlSchemaNamespace(element)) {
				// Find attribute value.
				//fixme implement
				string attributeValue = "";// XmlParser.GetAttributeValueAtIndex(xml, index);
				if (attributeValue.Length == 0) {
					return attribute;
				}
		
				if (attribute.Name == "ref") {
					schemaObject = FindSchemaObjectReference(attributeValue, currentSchemaCompletionData, element.Name);
				} else if (attribute.Name == "type") {
					schemaObject = FindSchemaObjectType(attributeValue, currentSchemaCompletionData, element.Name);
				}
			}
			
			if (schemaObject != null) {
				return schemaObject;
			}
			return attribute;
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:35,代码来源:XmlTextEditorExtension.cs


示例18: AddAttribute

            private XmlSchemaAttribute AddAttribute(string localName, string prefix, string childURI, string attrValue, bool bCreatingNewType, XmlSchema parentSchema, XmlSchemaObjectCollection addLocation, XmlSchemaObjectTable compiledAttributes)
            {
                if (childURI == XmlSchema.Namespace)
                {
                    throw new XmlSchemaInferenceException(Res.SchInf_schema, 0, 0);
                }

                XmlSchemaAttribute xsa = null;
                int AttributeType = -1;
                XmlSchemaAttribute returnedAttribute = null;    //this value will change to attributeReference if childURI!= parentURI
                XmlSchema xs = null;
                bool add = true;

                Debug.Assert(compiledAttributes != null); //AttributeUses is never null
                // First we need to look into the already compiled attributes 
                //   (they come from the schemaset which we got on input)
                // If there are none or we don't find it there, then we must search the list of attributes
                //   where we are going to add a new one (if it doesn't exist). 
                //   This is necessary to avoid adding duplicate attribute declarations.
                ICollection searchCollectionPrimary, searchCollectionSecondary;
                if (compiledAttributes.Count > 0) {
                    searchCollectionPrimary = compiledAttributes.Values;
                    searchCollectionSecondary = addLocation;
                }
                else {
                    searchCollectionPrimary = addLocation;
                    searchCollectionSecondary = null;
                }
                if (childURI == XmlReservedNs.NsXml)
                {
                    XmlSchemaAttribute attributeReference = null;
                    //see if the reference exists
                    attributeReference = FindAttributeRef(searchCollectionPrimary, localName, childURI);
                    if (attributeReference == null && searchCollectionSecondary != null) {
                        attributeReference = FindAttributeRef(searchCollectionSecondary, localName, childURI);
                    }
                    if (attributeReference == null)
                    {
                        attributeReference = new XmlSchemaAttribute();
                        attributeReference.RefName = new XmlQualifiedName(localName, childURI);
                        if (bCreatingNewType && this.Occurrence == InferenceOption.Restricted)
                        {
                            attributeReference.Use = XmlSchemaUse.Required;
                        }
                        else
                        {
                            attributeReference.Use = XmlSchemaUse.Optional;
                        }

                        addLocation.Add(attributeReference);
                    }
                    returnedAttribute = attributeReference;
                }
                else
                {
                    if (childURI.Length == 0)
                    {
                        xs = parentSchema;
                        add = false;
                    }
                    else if (childURI != null && !schemaSet.Contains(childURI))
                    {
                        /*if (parentSchema.AttributeFormDefault = XmlSchemaForm.Unqualified && childURI.Length == 0)
                    {
                        xs = parentSchema;
                        add = false;
                        break;
                    }*/
                        xs = new XmlSchema();
                        xs.AttributeFormDefault = XmlSchemaForm.Unqualified;
                        xs.ElementFormDefault = XmlSchemaForm.Qualified;
                        if (childURI.Length != 0)
                            xs.TargetNamespace = childURI;
                        //schemas.Add(childURI, xs);
                        this.schemaSet.Add(xs);
                        if (prefix.Length != 0 && String.Compare(prefix, "xml", StringComparison.OrdinalIgnoreCase) != 0)
                            NamespaceManager.AddNamespace(prefix, childURI);
                    }
                    else
                    {
                        ArrayList col = this.schemaSet.Schemas(childURI) as ArrayList;
                        if (col != null && col.Count > 0)
                        {
                            xs = col[0] as XmlSchema;
                        }

                    }
                    if (childURI.Length != 0) //
                    {
                        XmlSchemaAttribute attributeReference = null;
                        //see if the reference exists
                        attributeReference = FindAttributeRef(searchCollectionPrimary, localName, childURI);
                        if (attributeReference == null & searchCollectionSecondary != null) {
                            attributeReference = FindAttributeRef(searchCollectionSecondary, localName, childURI);
                        }
                        if (attributeReference == null)
                        {
                            attributeReference = new XmlSchemaAttribute();
                            attributeReference.RefName = new XmlQualifiedName(localName, childURI);
                            if (bCreatingNewType && this.Occurrence == InferenceOption.Restricted)
//.........这里部分代码省略.........
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:101,代码来源:infer.cs


示例19: v50

        public void v50()
        {
            bWarningCallback = false;
            bErrorCallback = false;
            XmlSchemaSet schemaSet = new XmlSchemaSet();

            XmlSchema schema = new XmlSchema();
            schemaSet.Add(schema);
            schema.TargetNamespace = "http://myns/";

            //type
            XmlSchemaType schemaType = new XmlSchemaComplexType();
            schemaType.Name = "MySimpleType";
            schema.Items.Add(schemaType);
            schemaSet.Reprocess(schema);
            schemaSet.Compile();

            //element
            XmlSchemaElement schemaElement = new XmlSchemaElement();
            schemaElement.Name = "MyElement";
            schema.Items.Add(schemaElement);
            schemaSet.Reprocess(schema);
            schemaSet.Compile();

            //attribute
            XmlSchemaAttribute schemaAttribute = new XmlSchemaAttribute();
            schemaAttribute.Name = "MyAttribute";
            schema.Items.Add(schemaAttribute);
            schemaSet.Reprocess(schema);
            schemaSet.Compile();

            schemaSet.Reprocess(schema);
            schemaSet.Compile();

            schema.Items.Remove(schemaType);//what is the best way to remove it?
            schema.Items.Remove(schemaElement);
            schema.Items.Remove(schemaAttribute);
            schemaSet.Reprocess(schema);
            schemaSet.Compile();

            schemaType = new XmlSchemaComplexType();
            schemaType.Name = "MySimpleType";
            schema.Items.Add(schemaType);
            schema.Items.Add(schemaElement);
            schema.Items.Add(schemaAttribute);
            schemaSet.Reprocess(schema);

            schemaSet.Compile();
            CError.Compare(schemaSet.GlobalElements.Count, 1, "Element count mismatch!");
            CError.Compare(schemaSet.GlobalAttributes.Count, 1, "Attributes count mismatch!");
            CError.Compare(schemaSet.GlobalTypes.Count, 2, "Types count mismatch!");

            return;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:54,代码来源:TC_SchemaSet_Reprocess.cs


示例20: v7

        public void v7()
        {
            try
            {
                XmlSchemaSet sc = new XmlSchemaSet();
                XmlSchema Schema1 = sc.Add(null, TestData._XsdAuthor);
                CError.Compare(sc.Count, 1, "Count after add");
                CError.Compare(sc.Contains(Schema1), true, "Contains after add");

                sc.Compile();
                CError.Compare(sc.Count, 1, "Count");
                CError.Compare(sc.Contains(Schema1), true, "Contains");

                //edit
                XmlSchemaAttribute attributeDog = new XmlSchemaAttribute();
                Schema1.Items.Add(attributeDog);
                attributeDog.Name = "dog";
                attributeDog.SchemaTypeName = new XmlQualifiedName("blah", "http://www.w3.org/2001/XMLSchema");
                sc.Reprocess(Schema1);
                CError.Compare(sc.Count, 1, "Count");
                CError.Compare(sc.Contains(Schema1), true, "Contains");
                CError.Compare(sc.IsCompiled, false, "IsCompiled");
                sc.Compile();
                CError.Compare(sc.IsCompiled, true, "IsCompiled");
                CError.Compare(Schema1.IsCompiled, true, "IsCompiled on SOM");
            }
            catch (XmlSchemaException e)
            {
                _output.WriteLine(e.ToString());
                return;
            }
            Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:33,代码来源:TC_SchemaSet_Reprocess.cs



注:本文中的System.Xml.Schema.XmlSchemaAttribute类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Schema.XmlSchemaChoice类代码示例发布时间:2022-05-26
下一篇:
C# Schema.XmlSchemaAnyAttribute类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap