Hi,
I have used XSD.exe to create some classes for serialization. In my XSD, I have an element like this:
<xs:complexType name="contentsType">
<xs:sequence>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
The resultant auto-generated class for this, looks like this:
<remarks/>///
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.intecgroup.co.uk/schemas/inform/formdata")]
public class contentsType {
/// <remarks/>
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any;
}
My problem is that I do not know how to populate this array before I serialize to XML. The constructor the XmlElement class is protected.
How do I create an XmlElement and add it to the Any array
Thanks in advance for your help.
Best wishes,
Sigol.

Serialization of "anyType"?
kmp112495
Derek - you're the man.
I just found the [same] solution the second you posted your message!
Thanks for your speedy reply. Much appreciated.
Best wishes,
Sigol.
Steve Nesbitt
If I read you right, you need to use the XmlDocument object to create an element. It has a CreateElement() method that returns a XmlElement object that you can then add to your array. I'd recommend looking in the help to see the different overloads for the CreateElement method, also there is an example there on how to use it.
Hope that was what your looking for.