What's the difference between and ?

前端 未结 4 1948
耶瑟儿~
耶瑟儿~ 2020-12-31 00:01

do you know if there\'s a difference between these tags on XML/XSD?

 and 

e.g:

<
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-31 00:50

    You get this as your XSD BusinessArea should be defined as nillable="true". Something like:

    
    .....
     
    

    What this mean is that BusinessArea element can have null value i.e. empty.

    And if element in XML doesn't contain any value then it must have attribute xsi:nil="true":

    
    

    This should be invalid :

    
    

    Two examples you showed should not be equivalent.

    Check this out for understanding xsi:nil and nillable:

    http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_over_st0.html

    http://www.w3.org/TR/xmlschema-0/#Nils

提交回复
热议问题