Note that there are some explanatory texts on larger screens.

plurals
  1. POXML deserialization using XSD/Code generation - Parsing Error
    primarykey
    data
    text
    <p>I'm trying to deserialize an XML document using an XSD. The error I am getting is:</p> <blockquote> <p>"There is an error in XML document (22, 8)."</p> </blockquote> <p>The <code>InnerException</code> is </p> <blockquote> <p>"Input string was not in a correct format."</p> </blockquote> <p>Now, row 22 of my sample XML document just has this:</p> <pre><code>&lt;PremiumPaymentDate&gt;2012-08-08&lt;/PremiumPaymentDate&gt; </code></pre> <p>Nothing wrong with that as far as I can see. The XSD specifies this row similarly like:</p> <pre><code>&lt;xs:element name="PremiumPaymentDate" type="xs:date" minOccurs="0"/&gt; </code></pre> <p>And the property it's trying to map to looks like this:</p> <pre><code>[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="date")] public System.DateTime PremiumPaymentDate { get { return this.premiumPaymentDateField; } set { this.premiumPaymentDateField = value; } } </code></pre> <p>I've tried removing this field completely, regenerated the code file from the XSD, changing the XSD around, changing the <code>minOccurs</code> value, changing the format of the field, removing the field data completely, and nothing is working.</p> <p>I'm also wondering why everything works up until row 22, because they are about 17 fields above this one that work fine, and a few of them are dates that are set up the same exact way. This one just doesn't want to parse for some reason.</p> <p>Edit:</p> <p>These dates work. These are above the date in question in the document. Here is the XSD for one that works:</p> <pre><code>&lt;xs:element name="effectivedate" type="xs:date" minOccurs="1"/&gt; </code></pre> <p>And here is the sample XML for the same one:</p> <pre><code>&lt;effectivedate&gt;2012-06-08&lt;/effectivedate&gt; </code></pre> <p>And the code property for it:</p> <pre><code>[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="date")] public System.DateTime effectivedate { get { return this.effectivedateField; } set { this.effectivedateField = value; } } </code></pre> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    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