It would be surprising if the schema documents you show produced the error message you quote; I would expect your first problem to be that your schema document is (you say) named skip.xsd, but the schemaLocation attribute on the relevant xs:include points to http://example.com/skip, and your second problem to be that your skip type is in namespace http://www.example.com/main but the declaration for the skip element refers to a type in namespace http://escmatrix.com/main. But I guess these are just clerical errors made in cutting down your example code for the question.
The error message is pretty clear: your wildcard is being interpreted as a strict wildcard, so elements which match it are expected to have declarations, and the document is invalid if they do not. Your wildcard is a strict one because you don't specify a processContents
attribute for it, and the default value of processContents
is strict
. If you want to allow undeclared elements, you will need to specify either processContents="lax"
or processContents="skip"
-- use a lax wildcard if elements for which declarations do exist should be validated against those declarations, use a skip wildcard if you don't want them to be validated at all, in which case the skip
element will be valid as long as its children are well formed. You say you want a schema that "validates my xml without error", by which I guess you mean "accepts my XML as valid in all cases" (the processor is already correctly and successfully checking the validity of your input without failure, so it's already validating your XML without error), so it looks as if you want a skip wildcard.