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


C# XmlSchemaForm.ToString方法代码示例

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


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

示例1: ClassAttributeFieldCode

        public virtual void ClassAttributeFieldCode(StreamWriter outStream, string dotNetDatatype, string xsdDatatype, string fieldName, string dotnetFieldName, XmlSchemaForm attributeFormDefault, bool isSchemaEnumerationType, string ns)
        {
            outStream.WriteLine();
            string str = fieldName;
            string str2 = ReplaceInvalidChars(dotnetFieldName);
            string str3 = this.CheckForKeywords(dotnetFieldName);
            string str4 = this.ConvertSystemDatatype(dotNetDatatype);
            string str5 = "";
            string str6 = "";
            if ((attributeFormDefault == XmlSchemaForm.Qualified) || (attributeFormDefault == XmlSchemaForm.Unqualified))
            {
                str6 = ",Form" + this.AttributeAssignmentOperator + "XmlSchemaForm." + attributeFormDefault.ToString();
                str5 = this.CalculateNamespace(this.schemaTargetNamespace, ns, dotNetDatatype == "System.Xml.XmlAttribute[]");
            }
            if (xsdDatatype == "anyType")
            {
                xsdDatatype = "";
            }
            else if (xsdDatatype != "")
            {
                xsdDatatype = ",DataType" + this.AttributeAssignmentOperator + "\"" + xsdDatatype + "\"";
            }
            switch (dotNetDatatype)
            {
                case "System.String":
                case "System.Byte[]":
                case "System.Object":
                case "System.Xml.XmlQualifiedName":
                    outStream.WriteLine(this.AttributeObjectTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    break;

                case "System.Xml.XmlAttribute[]":
                    outStream.WriteLine(this.AttributeAnyTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    break;

                case "System.DateTime":
                    outStream.WriteLine(this.AttributeDateTimeTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    break;

                default:
                    if (str4 == "string")
                    {
                        outStream.WriteLine(this.AttributeObjectTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    }
                    else
                    {
                        outStream.WriteLine(this.AttributeValueTypeTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    }
                    break;
            }
        }
开发者ID:MartinBG,项目名称:Gva,代码行数:51,代码来源:LanguageBase.cs

示例2: ClassElementFieldCode

        public virtual void ClassElementFieldCode(StreamWriter outStream, string dotNetDatatype, string xsdDatatype, string fieldName, string dotnetFieldName, decimal fieldOccurs, decimal particleOccurs, XmlSchemaForm elementFormDefault, bool isSchemaEnumerationType, string ns, bool isElementNullable)
        {
            outStream.WriteLine();
            string str = fieldName;
            string str2 = ReplaceInvalidChars(dotnetFieldName);
            string str3 = this.CheckForKeywords(dotnetFieldName);
            string str4 = this.ConvertSystemDatatype(dotNetDatatype);
            string str5 = "";
            string str6 = "";
            if ((elementFormDefault == XmlSchemaForm.Qualified) || (elementFormDefault == XmlSchemaForm.Unqualified))
            {
                str6 = ",Form" + this.AttributeAssignmentOperator + "XmlSchemaForm." + elementFormDefault.ToString();
                str5 = this.CalculateNamespace(this.schemaTargetNamespace, ns, dotNetDatatype == "System.Xml.XmlElement");
                if ((dotNetDatatype == "System.Xml.XmlElement") && (str5 != ""))
                {
                    str5 = "Name" + this.AttributeAssignmentOperator + "\"" + str3 + "\"" + str5;
                }
            }
            if (xsdDatatype == "anyType")
            {
                xsdDatatype = "";
            }
            else if (xsdDatatype != "")
            {
                xsdDatatype = ",DataType" + this.AttributeAssignmentOperator + "\"" + xsdDatatype + "\"";
            }
            if ((particleOccurs > 1M) || (fieldOccurs > 1M))
            {
                if (dotNetDatatype == "System.Xml.XmlElement")
                {
                    outStream.WriteLine(this.ElementAnyMaxOccursTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix, isElementNullable.ToString().ToLower() });
                }
                else
                {
                    outStream.WriteLine(this.FieldCollectionTemplate, new object[] { str2, str4, str, str6, str2, xsdDatatype, str5, hiddenMemberPrefix, collectionSuffix, isElementNullable.ToString().ToLower(), str4 });
                }
            }
            else
            {
                switch (dotNetDatatype)
                {
                    case "System.String":
                    case "System.Byte[]":
                    case "System.Object":
                    case "System.Xml.XmlQualifiedName":
                        outStream.WriteLine(this.ElementObjectTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix, isElementNullable.ToString().ToLower() });
                        return;

                    case "System.Xml.XmlElement":
                        outStream.WriteLine(this.ElementAnyTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix, isElementNullable.ToString().ToLower() });
                        return;

                    case "System.DateTime":
                        outStream.WriteLine(this.ElementDateTimeTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                        return;
                }
                if (str4 == "string")
                {
                    outStream.WriteLine(this.ElementObjectTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix, isElementNullable.ToString().ToLower() });
                }
                else
                {
                    outStream.WriteLine(this.ElementValueTypeTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                }
            }
        }
开发者ID:MartinBG,项目名称:Gva,代码行数:66,代码来源:LanguageBase.cs

示例3: ClassComplexTypeFieldCode

 public virtual void ClassComplexTypeFieldCode(StreamWriter outStream, string elementName, string dotnetTypeName, string collectionContainedType, string parentContainerClassName, decimal fieldOccurs, decimal particleOccurs, XmlSchemaForm elementFormDefault, string ns, bool isElementNullable, bool isAbstract)
 {
     outStream.WriteLine();
     string str = ReplaceInvalidChars(elementName);
     string str2 = this.CheckForKeywords(elementName);
     string str3 = this.CheckForKeywords(dotnetTypeName);
     string str4 = ReplaceInvalidChars(dotnetTypeName);
     collectionContainedType = this.CheckForKeywords(collectionContainedType);
     string str5 = "";
     string str6 = "";
     if ((elementFormDefault == XmlSchemaForm.Qualified) || (elementFormDefault == XmlSchemaForm.Unqualified))
     {
         str6 = ",Form" + this.AttributeAssignmentOperator + "XmlSchemaForm." + elementFormDefault.ToString();
         str5 = this.CalculateNamespace(this.schemaTargetNamespace, ns, false);
     }
     if ((particleOccurs > 1M) || (fieldOccurs > 1M))
     {
         outStream.WriteLine(this.FieldCollectionTemplate, new object[] { str4, str3, elementName, str6, str, "", str5, hiddenMemberPrefix, collectionSuffix, isElementNullable.ToString().ToLower(), collectionContainedType });
     }
     else if (isAbstract)
     {
         outStream.WriteLine(this.FieldAbstractClassTemplate, new object[] { str, str3, elementName, str6, str2, str5, hiddenMemberPrefix, isElementNullable.ToString().ToLower() });
     }
     else
     {
         outStream.WriteLine(this.FieldClassTemplate, new object[] { str, str3, elementName, str6, str2, str5, hiddenMemberPrefix, isElementNullable.ToString().ToLower() });
     }
 }
开发者ID:MartinBG,项目名称:Gva,代码行数:28,代码来源:LanguageBase.cs

示例4: ClassComplexTypeFieldCode

	/// <summary>
	/// Add a field to the class that will persist itself to an element -- who can have children (ComplexType)
	/// </summary>
	/// <param name="outStream"></param>
	/// <param name="elementName">Name attribute on a xsd:element.</element></param>
    /// <param name="dupElementName">Rename of the attribute on the xsd:element in case of duplicates in the xsd</element></param>
	/// <param name="dotnetTypeName">.NET class being referenced</param>
	/// <param name="parentContainerClassName">Owner class</param>
	/// <param name="fieldOccurs">maxOccurs on the field from XSD</param>
	/// <param name="particleOccurs">maxOccurs on the particle from XSD if the field is an instance</param>
	/// <param name="elementFormDefault">whether the XML attribute name generated by the XmlSerializer is qualified</param>
	/// <param name="isElementNullable">Set the IsNullable element paramter = true, causing xsi:nil="true" for null elements</param>
	/// <param name="isAbstract">complex type is marked as abstract, so it cannot be created</param>
	public virtual void ClassComplexTypeFieldCode(StreamWriter outStream, String elementName, string dupElementName,
		String dotnetTypeName, String collectionContainedType, String parentContainerClassName, decimal fieldOccurs, decimal particleOccurs,
		XmlSchemaForm elementFormDefault, string ns, bool isElementNullable, bool isAbstract)
	{
		outStream.WriteLine();

        string fieldName1 = ReplaceInvalidChars(dupElementName);
        string fieldName2 = CheckForKeywords(fieldName1);
		string fieldType1 = CheckForKeywords(dotnetTypeName);
		string fieldType2 = ReplaceInvalidChars(dotnetTypeName);
		collectionContainedType = CheckForKeywords(collectionContainedType);
	
	    string nameSpace = "";
		string schemaForm = "";
		if (elementFormDefault == XmlSchemaForm.Qualified || elementFormDefault == XmlSchemaForm.Unqualified)
		{
			schemaForm = ",Form" + AttributeAssignmentOperator + "XmlSchemaForm." + elementFormDefault.ToString();
			nameSpace = CalculateNamespace(schemaTargetNamespace, ns, false);
		}

		if (particleOccurs > 1 || fieldOccurs > 1)
		{
			outStream.WriteLine(FieldCollectionTemplate, fieldType2, fieldType1, elementName, schemaForm, fieldName1, "", nameSpace,
				hiddenMemberPrefix, collectionSuffix, isElementNullable.ToString().ToLower(), collectionContainedType);
		}
		else if (isAbstract)
		{
			outStream.WriteLine(FieldAbstractClassTemplate, fieldName1, fieldType1, elementName, schemaForm, fieldName2, nameSpace, hiddenMemberPrefix,
				isElementNullable.ToString().ToLower());
		}	
		else
		{
			outStream.WriteLine(FieldClassTemplate, fieldName1, fieldType1, elementName, schemaForm, fieldName2, nameSpace, hiddenMemberPrefix,
				isElementNullable.ToString().ToLower());
		}
	}
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:49,代码来源:LanguageTemplate.cs

示例5: ClassElementFieldCode

	/// <summary>
	/// Add a field to the class that will persist itself to an element (element with no children)
	/// </summary>
	/// <param name="outStream"></param>
	/// <param name="dotNetDatatype">.NET System datatype</param>
	/// <param name="xsdDatatype">XSD equivelent datatype</param>
	/// <param name="fieldName">Name of the element that will be a new field in code</param>
	/// <param name="dotnetFieldName">Name of the .net class field -- different from fieldName if duplicates occur</param>
	/// <param name="fieldOccurs">maxOccurs on the field from XSD</param>
	/// <param name="particleOccurs">maxOccurs on the particle from XSD if the field is an instance</param>
	/// <param name="elementFormDefault">whether the XML attribute name generated by the XmlSerializer is qualified</param>
	/// <param name="isSchemaEnumerationType">some languages like MC++ need to perform special logic if the field's type is an enumeration</param>
	/// <param name="ns">element namespace</param>
	/// <param name="isElementNullable">Set the IsNullable element paramter = true, causing xsi:nil="true" for null elements</param>
	public virtual void ClassElementFieldCode(StreamWriter outStream, string dotNetDatatype, string xsdDatatype,
		string fieldName, string dotnetFieldName, decimal fieldOccurs, decimal particleOccurs, XmlSchemaForm elementFormDefault,
		bool isSchemaEnumerationType, string ns, bool isElementNullable)
	{
		outStream.WriteLine();

		string elementName = fieldName;
		string fieldName1 = ReplaceInvalidChars(dotnetFieldName);
		string fieldName2 = CheckForKeywords(dotnetFieldName);
		string fieldType = ConvertSystemDatatype(dotNetDatatype);
		
		string nameSpace = "";
		string schemaForm = "";
		if (elementFormDefault == XmlSchemaForm.Qualified || elementFormDefault == XmlSchemaForm.Unqualified)
		{
			schemaForm = ",Form" + AttributeAssignmentOperator + "XmlSchemaForm." + elementFormDefault.ToString();
			nameSpace = CalculateNamespace(schemaTargetNamespace, ns, dotNetDatatype == "System.Xml.XmlElement");
			
			// special case for <xs:any> elements
			// <xs:any> has XmlElement dotnet type.
			if (dotNetDatatype == "System.Xml.XmlElement" && nameSpace != "") 
				nameSpace = "Name" + AttributeAssignmentOperator + "\"" + fieldName2 + "\"" + nameSpace;
		}
		
		if (xsdDatatype == "anyType") 
			xsdDatatype = "";
		else if (xsdDatatype != "") 
			xsdDatatype = ",DataType" + AttributeAssignmentOperator + "\"" + xsdDatatype + "\""; 

		if (particleOccurs > 1 || fieldOccurs > 1)
		{
			if (dotNetDatatype == "System.Xml.XmlElement")
			{
				outStream.WriteLine(ElementAnyMaxOccursTemplate, fieldName1, fieldType, elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
					hiddenMemberPrefix, isElementNullable.ToString().ToLower());
			}
			else
			{
				outStream.WriteLine(FieldCollectionTemplate, fieldName1, fieldType, elementName, schemaForm, fieldName1, xsdDatatype, nameSpace,
					hiddenMemberPrefix, collectionSuffix, isElementNullable.ToString().ToLower(), fieldType);
			}
		}
		else	
		{
			switch(dotNetDatatype)
			{
				// object type
				case "System.String": 
				case "System.Byte[]": 
				case "System.Object":
				case "System.Xml.XmlQualifiedName":
					outStream.WriteLine(ElementObjectTemplate, fieldName1, fieldType, elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
						hiddenMemberPrefix, isElementNullable.ToString().ToLower());
					break;
				// special xsd:any
				case "System.Xml.XmlElement" :
					// assuming properly formatted nameSpace from above with Name and Namespace parameters
					outStream.WriteLine(ElementAnyTemplate, fieldName1, fieldType, elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
						hiddenMemberPrefix, isElementNullable.ToString().ToLower());
					break;
				// value type
				case "System.DateTime":
					outStream.WriteLine(ElementDateTimeTemplate, fieldName1, fieldType, elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
						hiddenMemberPrefix);
					break;
				default:
					if (fieldType == "string")   // value types like System.Uri
						outStream.WriteLine(ElementObjectTemplate, fieldName1, fieldType, elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
							hiddenMemberPrefix, isElementNullable.ToString().ToLower());
					else
                        if (fieldType.StartsWith("OLI_LU_"))
                            outStream.WriteLine(ElementValueTypeTemplate, fieldName1, "int", elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
                            hiddenMemberPrefix);
                        else
						    outStream.WriteLine(ElementValueTypeTemplate, fieldName1, fieldType, elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
							    hiddenMemberPrefix);
					break;
			}
		}
	}
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:94,代码来源:LanguageTemplate.cs

示例6: ClassAttributeFieldCode

	/// <summary>
	/// Add a field to the class that will persist itself to an attrbute
	/// </summary>
	/// <param name="outStream"></param>
	/// <param name="dotNetDatatype">.NET System datatype</param>
	/// <param name="xsdDatatype">XSD equivelent datatype</param>
	/// <param name="fieldName">Name of the attribute that will be a new field in code</param>
	/// <param name="dotnetFieldName">Name of the .net class field -- different from fieldName if duplicates occur</param>
	/// <param name="attributeFormDefault">whether the XML attribute name generated by the XmlSerializer is qualified</param>
	/// <param name="isSchemaEnumerationType">some languages like MC++ need to perform special logic if the field's type is an enumeration</param>
	/// <param name="ns">attribute namesapce</param>
	public virtual void ClassAttributeFieldCode(StreamWriter outStream, string dotNetDatatype, string xsdDatatype,
		string fieldName, string dotnetFieldName, XmlSchemaForm attributeFormDefault, bool isSchemaEnumerationType, string ns)
	{  
		outStream.WriteLine();

		string attributeName = fieldName;
		string fieldName1 = ReplaceInvalidChars(dotnetFieldName);
		string fieldName2 = CheckForKeywords(dotnetFieldName);
		string fieldType = ConvertSystemDatatype(dotNetDatatype);

		string nameSpace = "";
		string schemaForm = "";
		if (attributeFormDefault == XmlSchemaForm.Qualified || attributeFormDefault == XmlSchemaForm.Unqualified)
		{
			schemaForm = ",Form" + AttributeAssignmentOperator + "XmlSchemaForm." + attributeFormDefault.ToString();
			nameSpace = CalculateNamespace(schemaTargetNamespace, ns, dotNetDatatype == "System.Xml.XmlAttribute[]");
		}

		if (xsdDatatype == "anyType") 
			xsdDatatype = "";
		else if (xsdDatatype != "") xsdDatatype = ",DataType" + AttributeAssignmentOperator + "\"" + xsdDatatype + "\""; 

		switch(dotNetDatatype)
		{
			// object type
			case "System.String": 
			case "System.Byte[]": 
			case "System.Object":
			case "System.Xml.XmlQualifiedName":
				outStream.WriteLine(AttributeObjectTemplate, fieldName1, fieldType, attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
					hiddenMemberPrefix);
				break;
			// special xsd:any
			case "System.Xml.XmlAttribute[]" :
				outStream.WriteLine(AttributeAnyTemplate, fieldName1, fieldType, attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
					hiddenMemberPrefix);
				break;
			// value type
			case "System.DateTime":
				outStream.WriteLine(AttributeDateTimeTemplate, fieldName1, fieldType, attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
					hiddenMemberPrefix);
				break;
			default:
				if (fieldType == "string")   // value types like System.Uri
					outStream.WriteLine(AttributeObjectTemplate, fieldName1, fieldType, attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
						hiddenMemberPrefix);
				else
                    if (fieldType.StartsWith("OLI_LU_"))  // special case for ACORD life
					    outStream.WriteLine(AttributeValueTypeTemplate, fieldName1, "int", attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
						    hiddenMemberPrefix);
                    else
                        outStream.WriteLine(AttributeValueTypeTemplate, fieldName1, fieldType, attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
                            hiddenMemberPrefix);
				break;
		}
	}
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:67,代码来源:LanguageTemplate.cs


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