views:

20

answers:

1

Is there a way to declare that an element can be null using Relax NG, something like xsi:nillable="true" using XSD?

+1  A: 

According to J. Clark in The Design of Relax NG Null values are not included as part of Relax NG. He proposes some alternatives to deal with these cases but we can argue that some times (i.e. array programming) the Null values are necessary as place holders. If we define extra arguments or elements to show that an element is null, we increase the complexity of the element structure though.

javier
You're right - it's a deliberate decision not to do it that way. The xsi:nillable is a bit of a hack anyway caused by the disjoint between relational models and XML. The correct way to do this in RelaxNG is to use co-occurrence constraints.
Nic Gibson