> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neuro-tech.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate contract XML locally

> Load the contract schemas in your XML validator and check a complete document before submission

Validate the complete contract against its XSD files before submitting it. Use an XML editor or validator that can load multiple schemas and resolve imports by namespace.

## 1. Save the schema dependencies

Download the eight XSD files in the [contract authoring schema set](/resources/schemas#download-the-contract-authoring-schema-set) into one local directory. Use the filenames listed in the catalog.

The [schema manifest](/downloads/xml-tools/schema-manifest.json) records each exact namespace, source URL, dependency, and SHA-256 checksum. Compare downloaded files with these checksums to confirm you have the documented revision.

For a LegalLab example with extra namespaces, also save its listed [additional schemas](/resources/schemas#additional-legallab-example-schemas). A custom payload requires its own XSD; follow [custom schema authoring](/resources/custom-schemas).

## 2. Associate namespaces with local files

In your validator's schema-set or XML-catalog settings, associate each namespace with the corresponding local XSD from the catalog. Load all dependencies before validating the contract.

For example, associate `urn:nf:iot:leg:sc:1.0` with `SmartContracts.xsd`. That schema imports identity, key, and XML-attribute definitions; the key schema also imports peer-address types. Some imports omit a file location, so opening only `SmartContracts.xsd` is insufficient.

Use the exact namespace strings. A namespace identifies the vocabulary; the downloaded file is its local schema location. Keep these associations in your validator configuration without changing the contract's namespaces.

Disable DTD processing and external network resolution for an offline check. Configure the validator to report elements with missing schemas, including machine-readable content inside the contract.

## 3. Validate the complete XML

Save the complete document as `MyContract.xml`, select the loaded schema set, and run XSD validation. Check the document root, required attributes, element ordering, and value types.

Expected result: the schema set compiles and the document has no validation errors. A message that XML is merely well-formed does not establish XSD validity.

As a check that your schema configuration is active, temporarily remove a required attribute such as `startState` from a state-machine definition. Validation should fail. Restore the original document before continuing.

## 4. Check machine references

For a contract containing a state machine, check references separately from the XSD result:

* `startState` and transition `newState` values must name defined states in the same machine.
* Each `actionRef` must name a defined action in that machine.
* Event references must match their declared event identifiers.

Use the [state-machine reference](/resources/state-machines-reference) to inspect the relevant elements. A validator may need additional checks for these relationships beyond XSD validation.

## Diagnose validation failures

| Symptom                            | What to check                                                                                     |
| ---------------------------------- | ------------------------------------------------------------------------------------------------- |
| Checksum mismatch                  | Obtain the documented revision or investigate a publisher change before updating your schema set. |
| No schema supplied for an element  | Associate its exact namespace with the correct XSD and load its imports.                          |
| Invalid child or missing attribute | Compare element order, required fields, and types with the relevant XSD.                          |
| Unresolved `actionRef` or state    | Define the referenced identifier inside the same machine and check spelling.                      |
| Unexpected contract namespace      | Match the contract and all its dependencies to the selected schema generation.                    |

## Continue with the Agent API

XML validation checks structure. It does not evaluate Script, verify signatures, approve templates, or execute a token's lifecycle. Submit the validated file through the [contract authoring workflow](/contracts/from-scratch#3-propose-the-template), then observe approval and execution separately.

For a custom vocabulary, confirm the provider can resolve its schema before submission. Your local namespace-to-file associations do not configure the provider's schema resolver.

## Original references

* [Neuro Foundation documentation](https://neuro-foundation.io/Index.md): specifications and technical reference material.
* [Script syntax and function reference](https://lab.tagroot.io/Script.md): the full language reference.
