Want the NULL mapped tag to be missed when generating XML from XSD using serialize

  • Hi,

    I have a certain set of minoccurs = 0 in my XSD.

    When mapping data to the class that I created using this XSD, it is found that the database is returning NULL for certain properties.

    I do not want these NULL property elements to appear in the XML

    Eg:

    <xs:element name="MyLevel" minOccurs = "0" type="xs:string"/>

    <xs:element name="YourLevel" minOccurs = "0" type="xs:string"/>

    <xs:element name="HisLevel" minOccurs = "0" type="xs:string"/>

    <xs:element name="HerLevel" minOccurs = "0" type="xs:string"/>

    Now if the database returns

    MyLevel as "20"

    YourLevel as NULL or Empty

    HisLevel as "30"

    HerLevel as "40"

    I would like the XML to look like

    <MyLevel>20</MyLevel>

    <HisLevel>30</HisLevel>

    <HerLevel>40</HerLevel>

    But I instead get

    <MyLevel>20</MyLevel>

    </YourLevel>

    <HisLevel>30</HisLevel>

    <HerLevel>40</HerLevel>

    Is there a certain property or condition that I may be missing? Is it possible to get the result I am looking for without using an if..else condition when mapping my dataset to the XSD object?

    HELP!!

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply