Setting minOccurs attribute

A

Andy

Hi,

When setting the XMLElementAttribute IsNullable=false I get the
minOccurs=0 in my WSDL:

C#:
[System.Xml.Serialization.XmlElementAttribute("XXXX",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public myType XXXX;
WSDL:
<s:element minOccurs="0" maxOccurs="1" form="unqualified" name="XXXX"
type="s0:myType" />


When setting the IsNullable=true

C#:
[System.Xml.Serialization.XmlElementAttribute("XXXX",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public myType XXXXX;
WSDL:
<s:element minOccurs="1" maxOccurs="1" form="unqualified" name="XXXX"
nillable="true" type="s0:myType" />


How can I set IsNullable=true and keep minOccurs="0"?

Any ideas?

Thanks,
Andy
 
D

Dino Chiesa [Microsoft]

I think if you modify your code like so:

[System.Xml.Serialization.XmlElementAttribute("XXXX",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public myType XXXXX;
[System.Xml.Serialization.XmlIgnore]
public bool XXXXXSpecified;

....you may get what you want. minOccurs="0" and nillable="true".


-Dino
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,086
Latest member
ChelseaAmi

Latest Threads

Top