# cvc-complex-type.2.4.c: strict wildcard, missing declaration

A wildcard can permit a child’s namespace while still requiring the validator to find a declaration for that child. processContents="strict" does exactly that. “Any” in xs:any therefore does not mean every undeclared element will validate.

## Literal meaning

Xerces matched the wildcard but could not obtain a global declaration for mystery. The schema also declares known, so replacing the mistaken element name with known makes the supplied document valid. Both versions keep the same envelope and wildcard; the example isolates declaration lookup from ordering.

## Three common causes

1. An extension element is misspelled or uses an unsupported vocabulary version. Its namespace satisfies the wildcard, but its expanded name has no matching declaration.
2. The extension schema was not loaded into the schema set. A remote schemaLocation hint does not guarantee that a validator will retrieve it.
3. A local element declaration is mistaken for a global declaration. A declaration nested inside another type does not automatically supply the wildcard’s global lookup target.

## Repair

Find the xs:any particle that accepts this child and read both namespace and processContents. Search the loaded schema set for a top-level declaration with the child’s namespace URI and local name. If an external vocabulary is intended, load its real schema and dependencies through the local project loader. Prefer correcting a mistaken name or loading a missing definition over changing strict to skip.

## Namespace checks

This is often a vocabulary-loading problem rather than an unbound-prefix problem. A declared prefix only associates a spelling with a URI; it does not load a schema. If the URI differs from the imported schema’s targetNamespace, even an otherwise complete project cannot supply the needed declaration.

The tested .NET message says the mystery element is not declared, while libxml2 mentions a strict wildcard. Distinguish this from cvc-elt.1.a at the document root: here envelope was already declared and accepted, and lookup fails only for the wildcard child.

## Strict wildcard / cvc-complex-type.2.4.c — Broken

```xml
<envelope>
  <mystery>ok</mystery>
</envelope>
```

```xml
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="known" type="xs:string"/>
  <xs:element name="envelope">
    <xs:complexType>
      <xs:sequence>
        <xs:any processContents="strict"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
```

[Open broken pair](https://xsdhub.com/?example=parser-strict-wildcard&variant=bad#workbench)

## Strict wildcard / cvc-complex-type.2.4.c — Corrected

```xml
<envelope>
  <known>ok</known>
</envelope>
```

```xml
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="known" type="xs:string"/>
  <xs:element name="envelope">
    <xs:complexType>
      <xs:sequence>
        <xs:any processContents="strict"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
```

[Open corrected pair](https://xsdhub.com/?example=parser-strict-wildcard&variant=good#workbench)

### Apache Xerces-J 2.12.2

```text
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mystery'.
```

Corrected: PASS.

### .NET 8.0.33 · System.Xml.Schema

```text
The 'mystery' element is not declared.
```

Corrected: PASS.

### XSDHub libxml2/WASM 0.7.2

```text
Element 'mystery': No matching global element declaration available, but demanded by the strict wildcard.
```

Corrected: PASS.

### XSDHub xmlschema 4.3.1 · XSD 1.0

```text
element 'mystery' not found
```

Corrected: PASS.

Saxon EE was not available; no measured Saxon wording is claimed.

[All parser codes](https://xsdhub.com/learn#parser-error-codes)
[Download engine evidence](https://xsdhub.com/parser-error-examples/engine-evidence.json)
