Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Setting minOccurs attribute

Reply
Thread Tools

Setting minOccurs attribute

 
 
Andy
Guest
Posts: n/a
 
      05-05-2004
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
 
Reply With Quote
 
 
 
 
Dino Chiesa [Microsoft]
Guest
Posts: n/a
 
      05-05-2004
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

--
Dino Chiesa
Microsoft Developer Division
d i n o c h @ OmitThis . m i c r o s o f t . c o m



"Andy" <> wrote in message
news: om...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xs:choice and child elements with minOccurs=0 Peter Larsen XML 0 07-21-2008 10:30 PM
Conditional MinOccurs in an XSD linushung@yahoo.com XML 2 05-24-2008 09:00 PM
maxOccurs setting with no minOccurs specified bruce_phipps@my-deja.com XML 6 11-19-2007 08:49 AM
Extending complex type - minOccurs katis XML 3 04-20-2007 10:11 AM
xerces schema validation: funny minOccurs behaviour mstilli@gmail.com XML 9 01-29-2007 03:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57