Search code examples
xmlvalidationxsdargon

Not valid NCName - XSD Validation error


The XSD has this element:

<xsd:element name = "systemReference" type = "xsd:IDREF"/>

And the value in my XML is this:

<systemReference>Axis Boss Ldn</systemReference>

And when the validation is triggered, it gives the error:

Message: Datatype error: Type:InvalidDatatypeValueException, Message:Value 'Axis Boss Ldn' is not valid NCName

I am not able to figure out what is wrong here.


Solution

  • You've declared systemReference to be a xsd:IDREF, which must be a valid NCName, but NCNames cannot contain spaces. Remove the spaces, or change the type to something like xsd:string.