当前位置: 首页>>代码示例>>C#>>正文


C# XmlSchema.GetType方法代码示例

本文整理汇总了C#中System.Xml.Schema.XmlSchema.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchema.GetType方法的具体用法?C# XmlSchema.GetType怎么用?C# XmlSchema.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Schema.XmlSchema的用法示例。


在下文中一共展示了XmlSchema.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestSerializeSchema

		public void TestSerializeSchema ()
		{
			XmlSchema schema = new XmlSchema ();
			schema.Items.Add (new XmlSchemaAttribute ());
			schema.Items.Add (new XmlSchemaAttributeGroup ());
			schema.Items.Add (new XmlSchemaComplexType ());
			schema.Items.Add (new XmlSchemaNotation ());
			schema.Items.Add (new XmlSchemaSimpleType ());
			schema.Items.Add (new XmlSchemaGroup ());
			schema.Items.Add (new XmlSchemaElement ());

			StringWriter sw = new StringWriter ();
			XmlTextWriter xtw = new XmlTextWriter (sw);
			xtw.QuoteChar = '\'';
			xtw.Formatting = Formatting.Indented;
			XmlSerializer xs = new XmlSerializer (schema.GetType ());
			xs.Serialize (xtw, schema);

			Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
				"<?xml version='1.0' encoding='utf-16'?>{0}" +
				"<xsd:schema xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>{0}" +
				"  <xsd:attribute />{0}" +
				"  <xsd:attributeGroup />{0}" +
				"  <xsd:complexType />{0}" +
				"  <xsd:notation />{0}" +
				"  <xsd:simpleType />{0}" +
				"  <xsd:group />{0}" +
				"  <xsd:element />{0}" +
				"</xsd:schema>", Environment.NewLine), sw.ToString ());
		}
开发者ID:frje,项目名称:SharpLang,代码行数:30,代码来源:XmlSerializerTests.cs

示例2: Write66_XmlSchema

 private void Write66_XmlSchema(string n, string ns, XmlSchema o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(XmlSchema)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.EscapeName = false;
         base.WriteStartElement(n, ns, o, false, o.Namespaces);
         if (needType)
         {
             base.WriteXsiType("XmlSchema", "http://www.w3.org/2001/XMLSchema");
         }
         if (o.AttributeFormDefault != XmlSchemaForm.None)
         {
             base.WriteAttribute("attributeFormDefault", "", this.Write6_XmlSchemaForm(o.AttributeFormDefault));
         }
         if (o.BlockDefault != XmlSchemaDerivationMethod.None)
         {
             base.WriteAttribute("blockDefault", "", this.Write7_XmlSchemaDerivationMethod(o.BlockDefault));
         }
         if (o.FinalDefault != XmlSchemaDerivationMethod.None)
         {
             base.WriteAttribute("finalDefault", "", this.Write7_XmlSchemaDerivationMethod(o.FinalDefault));
         }
         if (o.ElementFormDefault != XmlSchemaForm.None)
         {
             base.WriteAttribute("elementFormDefault", "", this.Write6_XmlSchemaForm(o.ElementFormDefault));
         }
         base.WriteAttribute("targetNamespace", "", o.TargetNamespace);
         base.WriteAttribute("version", "", o.Version);
         base.WriteAttribute("id", "", o.Id);
         XmlAttribute[] unhandledAttributes = o.UnhandledAttributes;
         if (unhandledAttributes != null)
         {
             for (int i = 0; i < unhandledAttributes.Length; i++)
             {
                 XmlAttribute node = unhandledAttributes[i];
                 base.WriteXmlAttribute(node, o);
             }
         }
         XmlSchemaObjectCollection includes = o.Includes;
         if (includes != null)
         {
             for (int j = 0; j < includes.Count; j++)
             {
                 XmlSchemaObject obj2 = includes[j];
                 if (obj2 is XmlSchemaRedefine)
                 {
                     this.Write64_XmlSchemaRedefine("redefine", "http://www.w3.org/2001/XMLSchema", (XmlSchemaRedefine) obj2, false, false);
                 }
                 else if (obj2 is XmlSchemaImport)
                 {
                     this.Write13_XmlSchemaImport("import", "http://www.w3.org/2001/XMLSchema", (XmlSchemaImport) obj2, false, false);
                 }
                 else if (obj2 is XmlSchemaInclude)
                 {
                     this.Write12_XmlSchemaInclude("include", "http://www.w3.org/2001/XMLSchema", (XmlSchemaInclude) obj2, false, false);
                 }
                 else if (obj2 != null)
                 {
                     throw base.CreateUnknownTypeException(obj2);
                 }
             }
         }
         XmlSchemaObjectCollection items = o.Items;
         if (items != null)
         {
             for (int k = 0; k < items.Count; k++)
             {
                 XmlSchemaObject obj3 = items[k];
                 if (obj3 is XmlSchemaElement)
                 {
                     this.Write52_XmlSchemaElement("element", "http://www.w3.org/2001/XMLSchema", (XmlSchemaElement) obj3, false, false);
                 }
                 else if (obj3 is XmlSchemaComplexType)
                 {
                     this.Write62_XmlSchemaComplexType("complexType", "http://www.w3.org/2001/XMLSchema", (XmlSchemaComplexType) obj3, false, false);
                 }
                 else if (obj3 is XmlSchemaSimpleType)
                 {
                     this.Write34_XmlSchemaSimpleType("simpleType", "http://www.w3.org/2001/XMLSchema", (XmlSchemaSimpleType) obj3, false, false);
                 }
                 else if (obj3 is XmlSchemaAttribute)
                 {
                     this.Write36_XmlSchemaAttribute("attribute", "http://www.w3.org/2001/XMLSchema", (XmlSchemaAttribute) obj3, false, false);
                 }
                 else if (obj3 is XmlSchemaAttributeGroup)
                 {
                     this.Write40_XmlSchemaAttributeGroup("attributeGroup", "http://www.w3.org/2001/XMLSchema", (XmlSchemaAttributeGroup) obj3, false, false);
                 }
                 else if (obj3 is XmlSchemaNotation)
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:ServiceDescriptionSerializationWriter.cs


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