title: XmlSerializer and XmlArrayItem
body: <p>The Xml looks like the following:</p>
  
  <pre><code>&lt;Publisher sequence="1" primaryIndicator="Yes"&gt;
    &lt;PublisherID idType="Shortname"&gt;ysc&lt;/PublisherID&gt;
    &lt;PublisherID idType="xy" encrypted="VlsC1V9K23Leo1BAOk6nxxROZAPKSAny" library="http://xys.abc.com"&gt;21503&lt;/PublisherID&gt;
    &lt;PublisherName nameType="Legal"&gt;xys legal name&lt;/PublisherName&gt;
  &lt;/Publisher&gt;
  </code></pre>
  
  <p>And my class is mapped as:</p>
  
  <pre><code>type PublisherId() = 
      [&lt;DefaultValue&gt;] val mutable _idType: string ;
      [&lt;DefaultValue&gt;] val mutable _encrypted: string ;
      [&lt;DefaultValue&gt;] val mutable _library: string ;
      [&lt;DefaultValue&gt;] val mutable _value: string ;
  
      [&lt;XmlAttribute&gt;] member this.idType with get() = this._idType and set(v) = this._idType &lt;- v
      [&lt;XmlAttribute&gt;] member this.encrypted with get() = this._encrypted and set(v) = this._encrypted &lt;- v
      [&lt;XmlAttribute&gt;] member this.library with get() = this._library and set(v) = this._library &lt;- v
      [&lt;XmlTextAttribute&gt;] member this.value with get() = this._value and set(v) = this._value &lt;- v
  
  type Publisher() as this = 
      [&lt;DefaultValue&gt;] val mutable _sequence : int
      [&lt;DefaultValue&gt;] val mutable _primaryIndicator: string ;
      [&lt;DefaultValue&gt;] val mutable _publisherIds : List&lt;PublisherId&gt;
  
      do
         this._publisherIds &lt;- new List&lt;PublisherId&gt;(); 
  
      [&lt;XmlAttribute&gt;] member this.sequence with get() = this._sequence and set(v) = this._sequence &lt;- v
      [&lt;XmlAttribute&gt;] member this.primaryIndicator with get() = this._primaryIndicator and set(v) = this._primaryIndicator &lt;- v
  
      [&lt;XmlArrayAttribute&gt;]
      [&lt;XmlArrayItem(typeof&lt;PublisherId&gt;, ElementName = "PublisherID")&gt;]
      member this.PublisherID with get() = this._publisherIds and set(v) = this._publisherIds &lt;- v
  </code></pre>
  
  <p>and I also modified the member attributes on the elemetn in question:</p>
  
  <pre><code>    [&lt;XmlArrayItem(typeof&lt;PublisherId&gt;, ElementName = "PublisherID")&gt;]
      member this.PublisherID with get() = this._publisherIds and set(v) = this._publisherIds &lt;- v
  </code></pre>
  
  <p>The problem is that, it is not populating the _publisherIds fields. I tried switching to an array and that didn't help either.  A breakpoint in the setter never gets hit, so I am thinking there is something wrong with the annotations.</p>
  
  <p>I have had success with structures like:</p>
  
  <pre><code>&lt;Publisher sequence="1" primaryIndicator="Yes"&gt;
    &lt;PublisherIDs&gt;
       &lt;PublisherID idType="Shortname"&gt;ysc&lt;/PublisherID&gt;
       &lt;PublisherID idType="xy" encrypted="VlsC1V9K23Leo1BAOk6nxxROZAPKSAny" library="http://xys.abc.com"&gt;21503&lt;/PublisherID&gt;
     &lt;/PublisherIDs&gt;
    &lt;PublisherName nameType="Legal"&gt;xys legal name&lt;/PublisherName&gt;
  &lt;/Publisher&gt;
  </code></pre>
  
  <p>using similar attributes (albeit in c#), however changing the XML structure is not ann option - as this is comming from a vendor. </p>
  
  <p><em>Note: I am tagging as C# as well as that group may be able to help with the annotations.  Please remove with my appologies, if that is an inappropriate tag.</em></p>
  
  <p>Thank you</p>