Note that there are some explanatory texts on larger screens.

plurals
  1. POXML Deserialization not deserializing element
    primarykey
    data
    text
    <p>Good Afternoon,</p> <p>I have the following classes</p> <pre><code>public class MaintenanceBundle { [XmlAttribute(AttributeName = "Required")] public string Required { get; set; } [XmlAttribute(AttributeName = "ID")] public string Id { get; set; } [XmlElement(ElementName = "Title")] public string Title { get; set; } [XmlElement(ElementName = "MntReason")] public MaintenanceReason Reason { get; set; } [XmlElement(ElementName = "Tasks")] public MaintenanceBundleCollection Tasks { get; set; } } public class MaintenanceBundleCollection { [XmlElement(ElementName = "Task")] public List&lt;MaintenanceBundleTask&gt; Tasks { get; set; } } public class MaintenanceReason { [XmlAttribute(AttributeName = "Every")] public string Every { get; set; } [XmlElement(ElementName = "Mileage", IsNullable = true)] public int? Mileage { get; set; } [XmlElement(ElementName = "Time", IsNullable = true)] public TimeInterval TimeInterval { get; set; } } </code></pre> <p>I'm trying to deserialize this xml to objects using these classes. Here is the XML</p> <pre><code>&lt;MntBundle Required="Yes" ID="S08870641702009101200000"&gt; &lt;Title&gt;DIRT OR DUSTY ROADS - 5000 MILES / 6 MONTHS&lt;/Title&gt; &lt;MntReason Every="No"&gt; &lt;Mileage Unit="MILES"&gt;5000&lt;/Mileage&gt; &lt;/MntReason&gt; &lt;Tasks&gt; &lt;Task ID="4-2" /&gt; &lt;Task ID="4-3"&gt; &lt;NMVCQualifier&gt;Drive Shaft Boots&lt;/NMVCQualifier&gt; &lt;MVCQualifiers&gt; &lt;Qualifier Name="Drive Type"&gt;4WD&lt;/Qualifier&gt; &lt;/MVCQualifiers&gt; &lt;/Task&gt; &lt;Task ID="4-1" /&gt; &lt;Task ID="4-4" /&gt; &lt;Task ID="5-1"&gt; &lt;MVCQualifiers&gt; &lt;Qualifier Name="Drive Type"&gt;4WD&lt;/Qualifier&gt; &lt;/MVCQualifiers&gt; &lt;/Task&gt; &lt;Task ID="6-1" /&gt; &lt;Task ID="7-1" /&gt; &lt;/Tasks&gt; &lt;/MntBundle&gt; </code></pre> <p>For some reason I am unable to get the Mileage element inside the MntReason element. It keeps coming back as null. Any ideas what I am doing wrong? All the other elements seem to deserialize properly. I left out irrelevant classes from my post. If anyone has any pointers how I can properly retreive this value I would love to hear it. Thanks so much for any help.</p> <p>Cheers,<br> ~ck in San Diego</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload