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

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.