These related facets place lower and upper bounds on the length measured by a simple datatype. They belong in one diagnostic guide because the repair starts with the same question: what does this type count, and at which processing stage?
What the message literally means
The minimum example requires at least three characters: AB has length two and ABC has length three. The maximum example permits at most five characters: ABCDEF has length six and ABCDE has length five. Each pair has its own complete schema so neither boundary can mask the other during reproduction.
Three common causes to check first
The exporter truncates a field, omits part of an identifier or sends a placeholder shorter than the required minimum. Empty tags count as empty values for these string specimens.
The value contains extra whitespace or added formatting. The base datatype’s whitespace behavior decides whether those characters survive before the length facet runs.
The application counts the wrong units. String length, list item count and binary length are different measures; byte counts and UI character counters need not match the schema datatype.
Repair and retest
Find the restriction base and determine the units used by its length facets. Check inherited bounds as well as the immediate declaration. Test the exact boundary, one unit below and one above using the receiving validator. Repair the original field or contract mapping rather than padding an identifier with arbitrary characters or silently dropping meaningful content.
When this is a namespace problem
Neither tested boundary failure is repaired by adding a namespace: the code element already matches its declaration. A namespace issue is plausible only when the wrong declaration or schema version supplies unexpected bounds. Verify the effective type before assuming that the validator’s reported length is a browser character-counting bug.
Reading equivalent reports
The corrected short strings are demonstrations of boundary behavior, not instructions to truncate production data. For identifiers, truncation can create collisions; for names, padding can corrupt meaning. Keep the original data and resolve the mapping or schema agreement that explains the bound. The two transcripts below preserve each engine’s own length wording.
Complete tested XML and XSD pairs
Open either variant in the workbench, then choose Validate XML. Loading an example does not run validation or send documents; server checks require the existing permission checkbox.
cvc-minLength-valid: Value 'AB' with length = '2' is not facet-valid with respect to minLength '3' for type '#AnonType_code'.
cvc-type.3.1.3: The value 'AB' of element 'code' is not valid.
PASS
.NET 8.0.33 · System.Xml.Schema Validation
The 'code' element is invalid - The value 'AB' is invalid according to its datatype 'String' - The actual length is less than the MinLength value.
PASS (no warnings)
XSDHub libxml2/WASM 0.7.2 Validation
Element 'code': [facet 'minLength'] The value has a length of '2'; this underruns the allowed minimum length of '3'.
PASS
XSDHub xmlschema 4.3.1 · XSD 1.0 Validation
value length cannot be lesser than 3
PASS
Saxon
EE comparison: cvc-minLength-valid describes the corresponding XSD constraint. No Saxon-EE run or wording is claimed; an EE licence is unavailable in this test environment. Saxon-HE does not provide XSD validation.
cvc-maxLength-valid: Value 'ABCDEF' with length = '6' is not facet-valid with respect to maxLength '5' for type '#AnonType_code'.
cvc-type.3.1.3: The value 'ABCDEF' of element 'code' is not valid.
PASS
.NET 8.0.33 · System.Xml.Schema Validation
The 'code' element is invalid - The value 'ABCDEF' is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.
PASS (no warnings)
XSDHub libxml2/WASM 0.7.2 Validation
Element 'code': [facet 'maxLength'] The value has a length of '6'; this exceeds the allowed maximum length of '5'.
PASS
XSDHub xmlschema 4.3.1 · XSD 1.0 Validation
value length cannot be greater than 5
PASS
Saxon
EE comparison: cvc-maxLength-valid describes the corresponding XSD constraint. No Saxon-EE run or wording is claimed; an EE licence is unavailable in this test environment. Saxon-HE does not provide XSD validation.
The corrected results apply to these self-contained XSD 1.0 specimens. They do not establish business-rule acceptance for a different document or schema version.