none
Duvida geração xml NFe RRS feed

  • Pergunta

  • Pessoal, preciso gerar o xml para emissao da NFE. Fiz o seguinte, baixei o schema.xsd e usei o xsd.exe, e foras geradas inumeras partial class.

    Instanciando cada partial class, consigo popular os objetos, Porem preciso serializar para xml, como são varias partial class, nao sei como juntar tudos os objetos e serializar o xml, alguem poderia dar uma ajuda ai ?

    abaixo um pedaço da classe que contem as partial class

    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //     Runtime Version:4.0.30319.18408
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    using System.Xml.Serialization;
    
    // 
    // This source code was auto-generated by xsd, Version=4.0.30319.33440.
    // 
        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.33440")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
        [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
        public partial class volItem
        {
    
            private string qVolField;
    
            private string espField;
    
            private string marcaField;
    
            private string nVolField;
    
            private decimal pesoL_transpField;
    
            private bool pesoL_transpFieldSpecified;
    
            private decimal pesoB_transpField;
    
            private bool pesoB_transpFieldSpecified;
    
            private lacresItem[] lacresField;
    
            /// <remarks/>
            public string qVol
            {
                get
                {
                    return this.qVolField;
                }
                set
                {
                    this.qVolField = value;
                }
            }
    
            /// <remarks/>
            public string esp
            {
                get
                {
                    return this.espField;
                }
                set
                {
                    this.espField = value;
                }
            }
    
            /// <remarks/>
            public string marca
            {
                get
                {
                    return this.marcaField;
                }
                set
                {
                    this.marcaField = value;
                }
            }
    
            /// <remarks/>
            public string nVol
            {
                get
                {
                    return this.nVolField;
                }
                set
                {
                    this.nVolField = value;
                }
            }
    
            /// <remarks/>
            public decimal pesoL_transp
            {
                get
                {
                    return this.pesoL_transpField;
                }
                set
                {
                    this.pesoL_transpField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlIgnoreAttribute()]
            public bool pesoL_transpSpecified
            {
                get
                {
                    return this.pesoL_transpFieldSpecified;
                }
                set
                {
                    this.pesoL_transpFieldSpecified = value;
                }
            }
    
            /// <remarks/>
            public decimal pesoB_transp
            {
                get
                {
                    return this.pesoB_transpField;
                }
                set
                {
                    this.pesoB_transpField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlIgnoreAttribute()]
            public bool pesoB_transpSpecified
            {
                get
                {
                    return this.pesoB_transpFieldSpecified;
                }
                set
                {
                    this.pesoB_transpFieldSpecified = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlArrayItemAttribute("lacresItem", IsNullable = false)]
            public lacresItem[] lacres
            {
                get
                {
                    return this.lacresField;
                }
                set
                {
                    this.lacresField = value;
                }
            }
        }
    
        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.33440")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
        [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
        public partial class lacresItem
        {
    
            private string nLacreField;
    
            /// <remarks/>
            public string nLacre
            {
                get
                {
                    return this.nLacreField;
                }
                set
                {
                    this.nLacreField = value;
                }
            }
        }
    
        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.33440")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
        [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
        public partial class vol
        {
    
            private volItem[] volItemField;
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute("volItem")]
            public volItem[] volItem
            {
                get
                {
                    return this.volItemField;
                }
                set
                {
                    this.volItemField = value;
                }
            }
        }
    
        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.33440")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
        [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
        public partial class veicTransp
        {
    
            private string placaField;
    
            private string uF_veictranspField;
    
            private string rNTCField;
    
            /// <remarks/>
            public string placa
            {
                get
                {
                    return this.placaField;
                }
                set
                {
                    this.placaField = value;
                }
            }
    
            /// <remarks/>
            public string UF_veictransp
            {
                get
                {
                    return this.uF_veictranspField;
                }
                set
                {
                    this.uF_veictranspField = value;
                }
            }
    
            /// <remarks/>
            public string RNTC
            {
                get
                {
                    return this.rNTCField;
                }
                set
                {
                    this.rNTCField = value;
                }
            }
        }
    
        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.33440")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
        [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
        public partial class veicProd
        {
    
            private string tpOpField;
    
            private string chassiField;
    
            private string cCorField;
    
            private string xCorField;
    
            private string potField;
    
            private string cilinField;
    
            private string pesoLField;
    
            private string pesoBField;
    
            private string nSerieField;
    
            private string tpCombField;
    
            private string nMotorField;
    
            private string cMTField;
    
            private string distField;
    
            private string anoModField;
    
            private string anoFabField;
    
            private string tpPintField;
    
            private string tpVeicField;
    
            private string espVeicField;
    
            private string vINField;
    
            private string condVeicField;
    
            private string cModField;
    
            private string cCorDENATRANField;
    
            private string lotaField;
    
            private string tpRestField;
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(DataType = "nonNegativeInteger")]
            public string tpOp
            {
                get
                {
                    return this.tpOpField;
                }
                set
                {
                    this.tpOpField = value;
                }
            }
    
            /// <remarks/>
            public string chassi
            {
                get
                {
                    return this.chassiField;
                }
                set
                {
                    this.chassiField = value;
                }
            }
    
            /// <remarks/>
            public string cCor
            {
                get
                {
                    return this.cCorField;
                }
                set
                {
                    this.cCorField = value;
                }
            }
    
            /// <remarks/>
            public string xCor
            {
                get
                {
                    return this.xCorField;
                }
                set
                {
                    this.xCorField = value;
                }
            }
    
            /// <remarks/>
            public string pot
            {
                get
                {
                    return this.potField;
                }
                set
                {
                    this.potField = value;
                }
            }
    
            /// <remarks/>
            public string cilin
            {
                get
                {
                    return this.cilinField;
                }
                set
                {
                    this.cilinField = value;
                }
            }
    
            /// <remarks/>
            public string PesoL
            {
                get
                {
                    return this.pesoLField;
                }
                set
                {
                    this.pesoLField = value;
                }
            }
    
            /// <remarks/>
            public string PesoB
            {
                get
                {
                    return this.pesoBField;
                }
                set
                {
                    this.pesoBField = value;
                }
            }
    
            /// <remarks/>
            public string nSerie
            {
                get
                {
                    return this.nSerieField;
                }
                set
                {
                    this.nSerieField = value;
                }
            }
    
            /// <remarks/>
            public string tpComb
            {
                get
                {
                    return this.tpCombField;
                }
                set
                {
                    this.tpCombField = value;
                }
            }
    
            /// <remarks/>
            public string nMotor
            {
                get
                {
                    return this.nMotorField;
                }
                set
                {
                    this.nMotorField = value;
                }
            }
    
            /// <remarks/>
            public string CMT
            {
                get
                {
                    return this.cMTField;
                }
                set
                {
                    this.cMTField = value;
                }
            }
    
            /// <remarks/>
            public string dist
            {
                get
                {
                    return this.distField;
                }
                set
                {
                    this.distField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(DataType = "nonNegativeInteger")]
            public string anoMod
            {
                get
                {
                    return this.anoModField;
                }
                set
                {
                    this.anoModField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(DataType = "nonNegativeInteger")]
            public string anoFab
            {
                get
                {
                    return this.anoFabField;
                }
                set
                {
                    this.anoFabField = value;
                }
            }
    
            /// <remarks/>
            public string tpPint
            {
                get
                {
                    return this.tpPintField;
                }
                set
                {
                    this.tpPintField = value;
                }
            }
    
            /// <remarks/>
            public string tpVeic
            {
                get
                {
                    return this.tpVeicField;
                }
                set
                {
                    this.tpVeicField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(DataType = "nonNegativeInteger")]
            public string espVeic
            {
                get
                {
                    return this.espVeicField;
                }
                set
                {
                    this.espVeicField = value;
                }
            }
    
            /// <remarks/>
            public string VIN
            {
                get
                {
                    return this.vINField;
                }
                set
                {
                    this.vINField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(DataType = "nonNegativeInteger")]
            public string condVeic
            {
                get
                {
                    return this.condVeicField;
                }
                set
                {
                    this.condVeicField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(DataType = "nonNegativeInteger")]
            public string cMod
            {
                get
                {
                    return this.cModField;
                }
                set
                {
                    this.cModField = value;
                }
            }
    
            /// <remarks/>
            public string cCorDENATRAN
            {
                get
                {
                    return this.cCorDENATRANField;
                }
                set
                {
                    this.cCorDENATRANField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(DataType = "nonNegativeInteger")]
            public string lota
            {
                get
                {
                    return this.lotaField;
                }
                set
                {
                    this.lotaField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(DataType = "nonNegativeInteger")]
            public string tpRest
            {
                get


    alessandre

    quinta-feira, 7 de maio de 2015 00:07