Beispiel #1
0
 internal void AddKeyHash(System.Text.StringBuilder sb)
 {
     sb.Append("XAAT ");
     KeyHelper.AddField(sb, 1, ns);
     KeyHelper.AddField(sb, 2, elementName);
     KeyHelper.AddField(sb, 3, form.ToString(), XmlSchemaForm.None.ToString());
     KeyHelper.AddField(sb, 4, isNullable);
     sb.Append('|');
 }
Beispiel #2
0
 internal void AddKeyHash(System.Text.StringBuilder sb)
 {
     sb.Append("XAA ");
     KeyHelper.AddField(sb, 1, ns);
     KeyHelper.AddField(sb, 2, attributeName);
     KeyHelper.AddField(sb, 3, form.ToString(), XmlSchemaForm.None.ToString());
     KeyHelper.AddField(sb, 4, dataType);
     KeyHelper.AddField(sb, 5, type);
     sb.Append('|');
 }
 internal void AddKeyHash(global::System.Text.StringBuilder sb)
 {
     sb.Append("XEA ");
     KeyHelper.AddField(sb, 1, ns);
     KeyHelper.AddField(sb, 2, elementName);
     KeyHelper.AddField(sb, 3, form.ToString(), XmlSchemaForm.None.ToString());
     KeyHelper.AddField(sb, 4, dataType);
     KeyHelper.AddField(sb, 5, type);
     KeyHelper.AddField(sb, 6, isNullable);
     sb.Append('|');
 }
Beispiel #4
0
 internal void AddKeyHash(System.Text.StringBuilder sb)
 {
     sb.Append("XAIA ");
     KeyHelper.AddField(sb, 1, ns);
     KeyHelper.AddField(sb, 2, elementName);
     KeyHelper.AddField(sb, 3, form.ToString(), XmlSchemaForm.None.ToString());
     KeyHelper.AddField(sb, 4, isNullable, true);
     KeyHelper.AddField(sb, 5, dataType);
     KeyHelper.AddField(sb, 6, nestingLevel, 0);
     KeyHelper.AddField(sb, 7, type);
     sb.Append('|');
 }
Beispiel #5
0
        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;
            }
        }
        /// <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(GeneratorStream generator, String elementName, string dupElementName,
                                                      String dotnetTypeName, String collectionContainedType, String parentContainerClassName, decimal fieldOccurs, decimal particleOccurs,
                                                      XmlSchemaForm elementFormDefault, string ns, bool isElementNullable, bool isAbstract, String default_value, bool is_required)
        {
            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)
            {
                generator.put_FieldCollectionTemplate(collectionContainedType, fieldName1, dupElementName, default_value, is_required);
                //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
            {
                generator.put_FieldClassTemplate(fieldType1, fieldName1, dupElementName, default_value, is_required);
                //outStream.WriteLine(FieldClassTemplate, fieldName1, fieldType1, elementName, schemaForm, fieldName2, nameSpace, hiddenMemberPrefix,
                //    isElementNullable.ToString().ToLower());
            }
        }
        /// <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(GeneratorStream generator, string dotNetDatatype, string xsdDatatype,
                                                  string fieldName, string dotnetFieldName, decimal fieldOccurs, decimal particleOccurs, XmlSchemaForm elementFormDefault,
                                                  bool isSchemaEnumerationType, string ns, bool isElementNullable, String default_value, bool is_required)
        {
            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
                {
                    generator.put_FieldCollectionTemplate(fieldType, elementName, elementName, default_value, is_required);
                    //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":
                    generator.put_ElementObjectTemplate(fieldType, fieldName1, elementName, default_value, is_required);
                    //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
                    {
                        generator.put_ElementObjectTemplate(fieldType, fieldName1, elementName, default_value, is_required);
                    }
                    //outStream.WriteLine(ElementObjectTemplate, fieldName1, fieldType, elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
                    //    hiddenMemberPrefix, isElementNullable.ToString().ToLower());
                    else
                    if (fieldType.StartsWith("OLI_LU_"))
                    {
                        generator.put_ElementValueTypeTemplate("int", fieldName1, elementName, default_value, is_required);
                    }
                    //outStream.WriteLine(ElementValueTypeTemplate, fieldName1, "int", elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
                    //hiddenMemberPrefix);
                    else
                    {
                        generator.put_ElementValueTypeTemplate(fieldType, fieldName1, elementName, default_value, is_required);
                    }
                    //outStream.WriteLine(ElementValueTypeTemplate, fieldName1, fieldType, elementName, schemaForm, xsdDatatype, fieldName2, nameSpace,
                    //hiddenMemberPrefix);
                    break;
                }
            }
        }
        /// <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(GeneratorStream generator, string dotNetDatatype, string xsdDatatype,
                                                    string fieldName, string dotnetFieldName, XmlSchemaForm attributeFormDefault, bool isSchemaEnumerationType, string ns, string default_value, bool is_required)
        {
            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":
                generator.put_AttributeObjectTemplate(fieldType, fieldName1, attributeName, default_value, is_required);
                //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
                {
                    generator.put_AttributeObjectTemplate(fieldType, fieldName1, attributeName, default_value, is_required);
                }
                //outStream.WriteLine(AttributeObjectTemplate, fieldName1, fieldType, attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
                //    hiddenMemberPrefix);
                else
                if (fieldType.StartsWith("OLI_LU_"))          // special case for ACORD life
                {
                    generator.put_AttributeValueTypeTemplate("int", fieldName1, attributeName, default_value, is_required);
                }
                //outStream.WriteLine(AttributeValueTypeTemplate, fieldName1, "int", attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
                //    hiddenMemberPrefix);
                else
                {
                    generator.put_AttributeValueTypeTemplate(fieldType, fieldName1, attributeName, default_value, is_required);
                }
                //outStream.WriteLine(AttributeValueTypeTemplate, fieldName1, fieldType, attributeName, schemaForm, xsdDatatype, fieldName2, nameSpace,
                //    hiddenMemberPrefix);
                break;
            }
        }
Beispiel #9
0
        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 });
                }
            }
        }
Beispiel #10
0
 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() });
     }
 }
	/// <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());
		}
	}
	/// <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;
			}
		}
	}
	/// <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;
		}
	}