I have this XML file and am able to read it, but it breaks and returns null once it gets to the item tags. NOTE: I only included the XML snippet that is giving me problems.
2019-03-12
1
ERP posting error (ERP integration timeout): Posted by Service User
filemanager.su@100039144
File Manager
File Manager
0
filemanagersprocess.su@100039144
File Manager
File Manager
3746.29
UTILITIES DEEK WAREHOUSE
66999939393
12345
Jimmy Johns
KL
0
(SALES)
0
Currently my class setup is:
namespace XmlDeserializer
{
[XmlRoot(ElementName = "ApproversList")]
public class ApproversList
{
[XmlElement(ElementName = "item")]
public Item Item { get; set; }
}
[XmlRoot(ElementName = "item")]
public class Item
{
[XmlElement(ElementName = "ApprovalDate")]
public string ApprovalDate { get; set; }
[XmlElement(ElementName = "Approved")]
public string Approved { get; set; }
[XmlElement(ElementName = "ApproverComment")]
public string ApproverComment { get; set; }
[XmlElement(ElementName = "ApproverEmail")]
public string ApproverEmail { get; set; }
[XmlElement(ElementName = "ApproverID")]
public string ApproverID { get; set; }
[XmlElement(ElementName = "ApproverLabelRole")]
public string ApproverLabelRole { get; set; }
[XmlElement(ElementName = "Approver")]
public string Approver { get; set; }
[XmlElement(ElementName = "Amount")]
public string Amount { get; set; }
[XmlElement(ElementName = "Assignment")]
public string Assignment { get; set; }
[XmlElement(ElementName = "BusinessArea")]
public string BusinessArea { get; set; }
[XmlElement(ElementName = "CCDescription")]
public string CCDescription { get; set; }
[XmlElement(ElementName = "CostCenter")]
public string CostCenter { get; set; }
[XmlElement(ElementName = "DeliveryNote")]
public string DeliveryNote { get; set; }
[XmlElement(ElementName = "Description")]
public string Description { get; set; }
[XmlElement(ElementName = "GLAccount")]
public string GLAccount { get; set; }
[XmlElement(ElementName = "GLDescription")]
public string GLDescription { get; set; }
[XmlElement(ElementName = "GoodReceipt")]
public string GoodReceipt { get; set; }
[XmlElement(ElementName = "InternalOrder")]
public string InternalOrder { get; set; }
[XmlElement(ElementName = "ItemNumber")]
public string ItemNumber { get; set; }
[XmlElement(ElementName = "LineType")]
public string LineType { get; set; }
[XmlElement(ElementName = "OrderNumber")]
public string OrderNumber { get; set; }
[XmlElement(ElementName = "Quantity")]
public string Quantity { get; set; }
[XmlElement(ElementName = "TaxAmount")]
public string TaxAmount { get; set; }
[XmlElement(ElementName = "TaxCode")]
public string TaxCode { get; set; }
[XmlElement(ElementName = "TaxJurisdiction")]
public string TaxJurisdiction { get; set; }
[XmlElement(ElementName = "TaxRate")]
public string TaxRate { get; set; }
}
}
Code that deserializes XML:
public static void DeserializeToObject(out Invoice invoice)
{
XmlSerializer serializer = new XmlSerializer(typeof(Invoice));
invoice = new Invoice();
using (FileStream fileStream = new FileStream(@"FILEPATH", FileMode.Open))
{
Invoice result = (Invoice)serializer.Deserialize(fileStream);
}
}
I have tried multiple possible solutions and can't get it to work correctly. This is my last resort.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)