/xXSDHub

XSD nillable and xsi:nil errors

xsi:nil="true" requires nillable="true" on the element declaration and an empty element body. It does not waive required attributes. Omission requires a permitted occurrence count; an empty string must still satisfy its type.

Distinguish nil, empty and absent

xsi:nil="true" requires nillable="true" on the element declaration and an empty element body. It does not waive required attributes. Omission requires a permitted occurrence count; an empty string must still satisfy its type.

Reproduced engine diagnostics and complete fixes

Original minimal examples checked on 2 November 2026. Engine wording differs; follow the cause, not a message alone.

libxml2-wasm 0.7.2

Element 'r': The element is not 'nillable'.

Xerces2-J 2.12.2 / Temurin Java 21.0.13+9-LTS

cvc-elt.3.1: Attribute 'http://www.w3.org/2001/XMLSchema-instance,nil' must not appear on element 'r', because the {nillable} property of 'r' is false.

lxml 6.0.2 / libxml2 2.14.6

Element 'r': The element is not 'nillable'.

.NET 10.0.14 / System.Xml

If the 'nillable' attribute is false in the schema, the 'xsi:nil' attribute must not be present in the instance.

Before: fails

<r xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
Open broken example →

After: passes

<r>ok</r>
Open corrected example →
Complete XSD (before)
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="r" type="xs:string"/></xs:schema>

Repeat this check in your workflow

API, Python CLI and GitHub Actions starter are available for automation. The public API is early access; paid CI authentication and SLA are not offered. Pro: US$19/month, 25-file batches and 10 saved schemas. Team: US$49/month, 100-file batches, 100 schemas and five seats.