Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 181193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:43:06+00:00 2026-05-11T14:43:06+00:00

I’m working on a Webservice to share data between 2 ERP-systems. First ERP calls

  • 0

I’m working on a Webservice to share data between 2 ERP-systems. First ERP calls the webservice, which serializes the data-object and sends it to the second ERP.

A data object looks like this:

    <xs:complexType name='Parent'>         <xs:sequence>             <xs:element ref='ta:ReceiptLine' maxOccurs='unbounded'/>         </xs:sequence>     </xs:complexType>     <xs:complexType name='Child'>         <xs:sequence>             ...             <xs:element name='SerialNo' type='xs:string' nillable='true' minOccurs='0'/>             <xs:element name='Quantity' type='xs:int' nillable='false'/>             ...         </xs:sequence>     </xs:complexType>     ...     <xs:element name='Child' type='ta:Child' nillable='true'/> 

The classes generated by XSD:

[System.Serializable]     [System.Xml.Serialization.XmlTypeAttribute(Namespace='http://FSM4TA/DataObjects/')]     [System.Xml.Serialization.XmlRootAttribute(Namespace='http://FSM4TA/DataObjects/', IsNullable=false)] public partial class Parent {     private Child[] child;      [System.Xml.Serialization.XmlElementAttribute('Child', IsNullable=true)]         public Child[] Child {             get {return this.child;}             set {this.child = value;} }  [System.Serializable]     [System.Xml.Serialization.XmlTypeAttribute(Namespace='http://FSM4TA/DataObjects/')]     [System.Xml.Serialization.XmlRootAttribute(Namespace='http://FSM4TA/DataObjects/', IsNullable=true)]     public partial class Child{         private string serialNo;         private int quantity;          [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]         public string SerialNo {             get {return this.serialNo;}             set {this.serialNo = value;}         }          public int Quantity {             get { return this.quantity;}             set {this.quantity = value;}         } } 

I’m serializing my data objects with XmlSerializer

The Problem Is: (On serialization) Every time in case of the Child object is empty (xsi:nil=’true’) XSD generates the whole Child structure anyway. And because Quantity is not nillable/nullable XSD writes 0 as value… Like this:

<Parent>   <Child xsi:nil='true'>     <SerialNo xsi:nil='true' />     <Quantity>0</Quantity>   </Child> </Parent> 

I expected to get something like this:

<Parent>   </Child xsi:nil='true'> </Parent> 

The Question Is: Is there a way to prevent XSD from parsing an xsi:nil=’true’-Object ??

Any suggestions?

TIA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:43:07+00:00Added an answer on May 11, 2026 at 2:43 pm

    ok,

    I got it now! You have to mark the Quantity property with the XmlElementAttribute explicitly!

    [XmlElement(IsNullable=false)] public int Quantity {         get { return this.quantity;}         set {this.quantity = value;}     } 

    No idea why this hasn’t been generated automatically…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
i got an object with contents of html markup in it, for example: string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.