@Jose Zero the paste special does not appear under edit. I've done it 1 year ago but can't repeat, but thanks I gonna try to find
Class in an array Invoice question again
Hi,
I got a question again, now on arrays of classes. I have the following lines and the invoice contains 5 invoiceline
Invoice[] MyData = new Invoice[5];
XmlSerializer serializer = new XmlSerializer(typeof(Invoice[]));
using (Stream reader = new FileStream(file, FileMode.Open))
{
MyData = (Invoice[]) serializer.Deserialize(reader);
}
string ID = MyData[0].ID;
but get the error
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderInvoiceArray.Read36_ArrayOfInvoice()
The class file
//------------------------------------------------------------------------------
// <auto-generated>
// Deze code is gegenereerd met een hulpprogramma.
// Runtime-versie:4.0.30319.42000
//
// Als u wijzigingen aanbrengt in dit bestand, kan dit onjuist gedrag veroorzaken wanneer
// de code wordt gegenereerd.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// This source code was auto-generated by xsd, Version=4.6.1055.0.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class Party
{
private PartyPartyName[] partyNameField;
private PartyPostalAddress[] postalAddressField;
private PartyPartyTaxScheme[] partyTaxSchemeField;
private PartyPartyLegalEntity[] partyLegalEntityField;
private PartyContact[] contactField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("PartyName")]
public PartyPartyName[] PartyName
{
get
{
return this.partyNameField;
}
set
{
this.partyNameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("PostalAddress")]
public PartyPostalAddress[] PostalAddress
{
get
{
return this.postalAddressField;
}
set
{
this.postalAddressField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("PartyTaxScheme")]
public PartyPartyTaxScheme[] PartyTaxScheme
{
get
{
return this.partyTaxSchemeField;
}
set
{
this.partyTaxSchemeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("PartyLegalEntity")]
public PartyPartyLegalEntity[] PartyLegalEntity
{
get
{
return this.partyLegalEntityField;
}
set
{
this.partyLegalEntityField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Contact")]
public PartyContact[] Contact
{
get
{
return this.contactField;
}
set
{
this.contactField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class PartyPartyName
{
private string nameField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string Name
{
get
{
return this.nameField;
}
set
{
this.nameField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class PartyPostalAddress
{
private string streetNameField;
private string cityNameField;
private string postalZoneField;
private PartyPostalAddressCountry[] countryField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string StreetName
{
get
{
return this.streetNameField;
}
set
{
this.streetNameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string CityName
{
get
{
return this.cityNameField;
}
set
{
this.cityNameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string PostalZone
{
get
{
return this.postalZoneField;
}
set
{
this.postalZoneField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Country")]
public PartyPostalAddressCountry[] Country
{
get
{
return this.countryField;
}
set
{
this.countryField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class PartyPostalAddressCountry
{
private string identificationCodeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string IdentificationCode
{
get
{
return this.identificationCodeField;
}
set
{
this.identificationCodeField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class PartyPartyTaxScheme
{
private CompanyID companyIDField;
private TaxScheme[] taxSchemeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = true)]
public CompanyID CompanyID
{
get
{
return this.companyIDField;
}
set
{
this.companyIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("TaxScheme")]
public TaxScheme[] TaxScheme
{
get
{
return this.taxSchemeField;
}
set
{
this.taxSchemeField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = true)]
public partial class CompanyID
{
private string schemeIDField;
private string valueField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string schemeID
{
get
{
return this.schemeIDField;
}
set
{
this.schemeIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class TaxScheme
{
private string idField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string ID
{
get
{
return this.idField;
}
set
{
this.idField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class PartyPartyLegalEntity
{
private string registrationNameField;
private CompanyID companyIDField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string RegistrationName
{
get
{
return this.registrationNameField;
}
set
{
this.registrationNameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = true)]
public CompanyID CompanyID
{
get
{
return this.companyIDField;
}
set
{
this.companyIDField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class PartyContact
{
private string nameField;
private string telephoneField;
private string electronicMailField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string Name
{
get
{
return this.nameField;
}
set
{
this.nameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string Telephone
{
get
{
return this.telephoneField;
}
set
{
this.telephoneField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string ElectronicMail
{
get
{
return this.electronicMailField;
}
set
{
this.electronicMailField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class OrderReference
{
private string idField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string ID
{
get
{
return this.idField;
}
set
{
this.idField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class AdditionalDocumentReference
{
private string idField;
private string documentDescriptionField;
private AdditionalDocumentReferenceAttachment[] attachmentField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string ID
{
get
{
return this.idField;
}
set
{
this.idField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string DocumentDescription
{
get
{
return this.documentDescriptionField;
}
set
{
this.documentDescriptionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Attachment")]
public AdditionalDocumentReferenceAttachment[] Attachment
{
get
{
return this.attachmentField;
}
set
{
this.attachmentField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class AdditionalDocumentReferenceAttachment
{
private EmbeddedDocumentBinaryObject embeddedDocumentBinaryObjectField;
private AdditionalDocumentReferenceAttachmentExternalReference[] externalReferenceField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public EmbeddedDocumentBinaryObject EmbeddedDocumentBinaryObject
{
get
{
return this.embeddedDocumentBinaryObjectField;
}
set
{
this.embeddedDocumentBinaryObjectField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("ExternalReference")]
public AdditionalDocumentReferenceAttachmentExternalReference[] ExternalReference
{
get
{
return this.externalReferenceField;
}
set
{
this.externalReferenceField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = false)]
public partial class EmbeddedDocumentBinaryObject
{
private string mimeCodeField;
private string filenameField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string mimeCode
{
get
{
return this.mimeCodeField;
}
set
{
this.mimeCodeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string filename
{
get
{
return this.filenameField;
}
set
{
this.filenameField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class AdditionalDocumentReferenceAttachmentExternalReference
{
private string uRIField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string URI
{
get
{
return this.uRIField;
}
set
{
this.uRIField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class AccountingSupplierParty
{
private Party[] partyField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Party")]
public Party[] Party
{
get
{
return this.partyField;
}
set
{
this.partyField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class AccountingCustomerParty
{
private Party[] partyField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Party")]
public Party[] Party
{
get
{
return this.partyField;
}
set
{
this.partyField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class PaymentMeans
{
private string paymentMeansCodeField;
private string paymentIDField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string PaymentMeansCode
{
get
{
return this.paymentMeansCodeField;
}
set
{
this.paymentMeansCodeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string PaymentID
{
get
{
return this.paymentIDField;
}
set
{
this.paymentIDField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class PaymentTerms
{
private string noteField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
public string Note
{
get
{
return this.noteField;
}
set
{
this.noteField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", IsNullable = false)]
public partial class TaxTotal
{
private TaxAmount taxAmountField;
private TaxTotalTaxSubtotal[] taxSubtotalField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = true)]
public TaxAmount TaxAmount
{
get
{
return this.taxAmountField;
}
set
{
this.taxAmountField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("TaxSubtotal")]
public TaxTotalTaxSubtotal[] TaxSubtotal
{
get
{
return this.taxSubtotalField;
}
set
{
this.taxSubtotalField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = true)]
public partial class TaxAmount
{
private string currencyIDField;
private string valueField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string currencyID
{
get
{
return this.currencyIDField;
}
set
{
this.currencyIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class TaxTotalTaxSubtotal
{
private TaxableAmount taxableAmountField;
private TaxAmount taxAmountField;
private TaxTotalTaxSubtotalTaxCategory[] taxCategoryField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = true)]
public TaxableAmount TaxableAmount
{
get
{
return this.taxableAmountField;
}
set
{
this.taxableAmountField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = true)]
public TaxAmount TaxAmount
{
get
{
return this.taxAmountField;
}
set
{
this.taxAmountField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("TaxCategory")]
public TaxTotalTaxSubtotalTaxCategory[] TaxCategory
{
get
{
return this.taxCategoryField;
}
set
{
this.taxCategoryField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", IsNullable = true)]
public partial class TaxableAmount
{
private string currencyIDField;
private string valueField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string currencyID
{
get
{
return this.currencyIDField;
}
set
{
this.currencyIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")]
public partial class TaxTotalTaxSubtotalTaxCategory
{
private string idField;
private string percentField;
private TaxScheme[] taxSchemeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xs
4 additional answers
Sort by: Most helpful
-
Jose Zero 576 Reputation points
2021-11-25T20:56:11.577+00:00 Are you trying to Deserialize a bunch of Invoices without an XML Root Element?
If yes, there should be a Root Element to enclose all invoices.
I don´t think this is what you looking for, but your code drive me to understand what I told above.On the other hand, per your class, only Invoice.InvoiceLine.Item and Invoice.InvoiceLine.Price are of type Array
-
Rinaldo 396 Reputation points
2021-11-25T21:45:43.553+00:00 I post the XML, I don't see it anymore
<?xml version="1.0" encoding="UTF-8"?> <Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd"> <cbc:UBLVersionID>2.1</cbc:UBLVersionID> <cbc:CustomizationID>urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol4a:ver2.0:extended:urn:www.simplerinvoicing.org:si:si-ubl:ver1.1.x</cbc:CustomizationID> <cbc:ProfileID>urn:www.cenbii.eu:profile:bii04:ver2.0</cbc:ProfileID> <cbc:ID>21534436</cbc:ID> <cbc:IssueDate>2021-10-12</cbc:IssueDate> <cbc:Note>Complies.nl weborder</cbc:Note> <cbc:TaxPointDate>2021-10-12</cbc:TaxPointDate> <cbc:AccountingCostCode></cbc:AccountingCostCode> <cac:AccountingSupplierParty> <cac:Party> <cac:PartyName> <cbc:Name>Complies BV</cbc:Name> </cac:PartyName> <cac:PostalAddress> <cbc:StreetName>Handelsweg 30-32</cbc:StreetName> <cbc:CityName>Tynaarlo</cbc:CityName> <cbc:PostalZone>9482 WE</cbc:PostalZone> <cac:Country> <cbc:IdentificationCode>NL</cbc:IdentificationCode> </cac:Country> </cac:PostalAddress> <cac:PartyTaxScheme> <cbc:CompanyID>NL809414314B01</cbc:CompanyID> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:PartyTaxScheme> <cac:PartyLegalEntity> <cbc:CompanyID>02049841</cbc:CompanyID> </cac:PartyLegalEntity> <cac:Contact> <cbc:Name>Complies</cbc:Name> <cbc:Telephone>0592-340350</cbc:Telephone> <cbc:Telefax></cbc:Telefax> <cbc:ElectronicMail>******@complies.nl</cbc:ElectronicMail> </cac:Contact> </cac:Party> </cac:AccountingSupplierParty> <cac:AccountingCustomerParty> <cac:Party> <cac:PartyName> <cbc:Name>LoginPC Noord (kpl 7653)</cbc:Name> </cac:PartyName> <cac:PostalAddress> <cbc:StreetName>Droogbak 1D</cbc:StreetName> <cbc:CityName>AMSTERDAM</cbc:CityName> <cbc:PostalZone>1013 GE</cbc:PostalZone> <cac:Country> <cbc:IdentificationCode>NL</cbc:IdentificationCode> </cac:Country> </cac:PostalAddress> <cac:PartyTaxScheme> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:PartyTaxScheme> <cac:Contact> <cbc:Name>Rinaldo Visscher</cbc:Name> <cbc:Telephone>-</cbc:Telephone> <cbc:Telefax></cbc:Telefax> <cbc:ElectronicMail>******@loginpc.nl</cbc:ElectronicMail> </cac:Contact> </cac:Party> </cac:AccountingCustomerParty> <cac:PaymentMeans> <cbc:PaymentMeansCode>ZZZ</cbc:PaymentMeansCode> <cbc:PaymentDueDate>2021-10-26</cbc:PaymentDueDate> <cbc:PaymentChannelCode></cbc:PaymentChannelCode> <cbc:InstructionID></cbc:InstructionID> <cbc:InstructionNote></cbc:InstructionNote> <cac:PayeeFinancialAccount> <cbc:ID>NL97RABO0141875941</cbc:ID> <cac:FinancialInstitutionBranch> <cbc:ID>RABONL2U</cbc:ID> <cbc:Name>Rabobank</cbc:Name> </cac:FinancialInstitutionBranch> </cac:PayeeFinancialAccount> </cac:PaymentMeans> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">44.1504</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">210.24</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">44.1504</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:LegalMonetaryTotal> <cbc:TaxExclusiveAmount currencyID="EUR">210.24</cbc:TaxExclusiveAmount> <cbc:PayableAmount currencyID="EUR">254.3904</cbc:PayableAmount> </cac:LegalMonetaryTotal> <cac:InvoiceLine> <cbc:ID>1</cbc:ID> <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="ZZ">1</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="EUR">10.74</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>1</cbc:LineID> <cac:OrderReference> <cbc:ID>40220138</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">2.2554</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">10.74</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">2.2554</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:Item> <cbc:Name>Ewent USB 3.1 Gen1 (USB 3.0) Hub 4 port Type-C connector</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>EW1137</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="EUR">10.74</cbc:PriceAmount> <cbc:BaseQuantity>1</cbc:BaseQuantity> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>2</cbc:ID> <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="ZZ">5</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="EUR">81.65</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>2</cbc:LineID> <cac:OrderReference> <cbc:ID>40220138</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">17.1465</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">81.65</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">17.1465</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:Item> <cbc:Name>Ewent Ultra-compacte laptoplader 45W (laptops till 15.6inch)</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>EW3984</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="EUR">81.65</cbc:PriceAmount> <cbc:BaseQuantity>1</cbc:BaseQuantity> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>3</cbc:ID> <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="ZZ">3</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="EUR">70.26</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>3</cbc:LineID> <cac:OrderReference> <cbc:ID>40220138</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">14.7546</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">70.26</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">14.7546</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:Item> <cbc:Name>PSU LC-Power LC500H-12 V2.2 500W ATX Grijs</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>LC500H-12</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="EUR">70.26</cbc:PriceAmount> <cbc:BaseQuantity>1</cbc:BaseQuantity> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>4</cbc:ID> <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="ZZ">5</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="EUR">46.6</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>4</cbc:LineID> <cac:OrderReference> <cbc:ID>40220138</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">9.786</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">46.6</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">9.786</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:Item> <cbc:Name>TP-Link AC600 T2U Wireless USB Nano Adapter</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>ARCHERT2UNANO</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="EUR">46.6</cbc:PriceAmount> <cbc:BaseQuantity>1</cbc:BaseQuantity> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>5</cbc:ID> <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="ZZ">1</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="EUR">6.95</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>6</cbc:LineID> <cac:OrderReference> <cbc:ID>40220138</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">1.4595</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">6.95</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">1.4595</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:Item> <cbc:Name>Verzendkosten NL</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>HAND1</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="EUR">6.95</cbc:PriceAmount> <cbc:BaseQuantity>1</cbc:BaseQuantity> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>6</cbc:ID> <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="ZZ">1</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="EUR">-6.95</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>7</cbc:LineID> <cac:OrderReference> <cbc:ID>40220138</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">-1.4595</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">-6.95</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">-1.4595</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:Item> <cbc:Name>WEBKORTING</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>KORTING</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="EUR">-6.95</cbc:PriceAmount> <cbc:BaseQuantity>1</cbc:BaseQuantity> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>7</cbc:ID> <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="ZZ">1</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="EUR">0.99</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>8</cbc:LineID> <cac:OrderReference> <cbc:ID>40220138</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">0.2079</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">0.99</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">0.2079</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:Item> <cbc:Name>Verpakkingsfee NL</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>VERPAKKINGSFEE-NL</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="EUR">0.99</cbc:PriceAmount> <cbc:BaseQuantity>1</cbc:BaseQuantity> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>8</cbc:ID> <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="ZZ">1</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="EUR">0</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>0</cbc:LineID> <cac:OrderReference> <cbc:ID></cbc:ID> </cac:OrderReference> </cac:OrderLineReference> <cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">0</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">0</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">0</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID> <cbc:Percent>21</cbc:Percent> <cac:TaxScheme> <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:Item> <cbc:Name>Within 14 days</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>14</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="EUR">0</cbc:PriceAmount> <cbc:BaseQuantity>1</cbc:BaseQuantity> </cac:Price> </cac:InvoiceLine> </Invoice>
-
Jose Zero 576 Reputation points
2021-11-25T22:01:37.883+00:00 @Rinaldo , As I told, inspect XML.
Posted XML file has no relation with your "Invoice Class" generated, it is totally different, you need to make a new class to read this XML posted.
As I suggested on the other thread, Copy XML and Paste Special > Paste XML as Classes, then compare both Invoice Classes (existing and new one)
As soon you use correct class you get what you want.Copy/Paste just help for this particular case. so as soon as you can look for the proper XSD Scheme then Generate classes for it.
-
Rinaldo 396 Reputation points
2021-11-25T22:51:52.41+00:00 @Jose Zero thanks for the support, had to install ASP.net for paste special as xml otherwise it's not avaible It's middel of the night here, take a rest.