1

So, I have the following data contract:

[DataContract(Namespace = "http://abc/Services/Data")]
public abstract class AbcObject
{
    [DataMember]
    [XmlAnyElement]
    public XmlElement[] Any { get; set; }
}

My expectation is to see the following corresponding xs:complexType element in the generated wsdl:

<xs:complexType name="AbcObject">
    <xs:sequence>
        <xsd:any minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

However, what I actually see is:

<xs:complexType name="AbcObject">
    <xs:sequence>
        <xs:element name="Any" type="q1:ArrayOfXmlElement" nillable="true" minOccurs="0" xmlns:q1="http://schemas.datacontract.org/2004/07/System.Xml"/>
    </xs:sequence>
</xs:complexType>

So, this is not what I want, but I am kind of puzzled how to get the xsd:any generated for me.

Any ideas?

EDIT 1

As per jamiemeyer advice I have changed the DFObject.Any property to be of type XmlAttribute[]. Here is the result:

<xs:complexType name="DFObject">
    <xs:sequence>
        <xs:element name="Any" type="q1:ArrayOfArrayOfanyType" nillable="true" minOccurs="0" xmlns:q1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
    </xs:sequence>
</xs:complexType>

Although the result is different, it is still not xsd:any.

Community
  • 1
  • 1
mark
  • 59,016
  • 79
  • 296
  • 580
  • Looking at an old project, I believe that if you modify XmlElement[] to XmlAttribute[] you will achieve the results you are after. – JamieMeyer Nov 17 '15 at 00:06
  • Does this answer your question? [XML validation with XSD: how to avoid caring about the sequence of the elements?](https://stackoverflow.com/questions/3325247/xml-validation-with-xsd-how-to-avoid-caring-about-the-sequence-of-the-elements) – Michael Freidgeim Jan 19 '21 at 01:10
  • I am out of context now, but I do not see how it helps. – mark Jan 20 '21 at 00:54

0 Answers0