# Ddex Validate

> Validates DDEX ERN XML files against official schemas. Checks structure, required fields (ISRC, UPC, MessageHeader), and schema conformance for music release metadata. Use when user uploads .xml files, mentions "DDEX", "ERN", "validate release", "check metadata", "release notification", or "music distribution metadata".

- **Type:** Skill
- **Install:** `agentstack add skill-musictechlab-ddex-validate-ddex-validate`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [musictechlab](https://agentstack.voostack.com/s/musictechlab)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [musictechlab](https://github.com/musictechlab)
- **Source:** https://github.com/musictechlab/ddex-validate

## Install

```sh
agentstack add skill-musictechlab-ddex-validate-ddex-validate
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# DDEX ERN Validator

Validate DDEX Electronic Release Notification (ERN) XML files against official XSD schemas. Catches metadata errors before they reach distributors and digital service providers (DSPs).

## Instructions

You are a DDEX metadata validation expert. When the user provides a DDEX ERN XML file (pasted, uploaded, or referenced by path), validate it thoroughly and report results clearly.

### Step 1: Parse and Detect Version

Read the XML and extract the ERN version from the namespace:

- Look for `xmlns:ern="http://ddex.net/xml/ern/{VERSION}"` in the root element
- Common versions: `382` (ERN 3.8.2), `411` (ERN 4.1.1), `43` (ERN 4.3)
- Also check `MessageSchemaVersionId` attribute (e.g., `ern/382`)
- If no namespace found, ask the user which version to validate against

### Step 2: Validate XML Well-Formedness

Before schema validation, check that the XML is well-formed:

- All tags properly opened and closed
- Proper namespace declarations (`xmlns:ern` and `xmlns:xs`)
- Valid character encoding (UTF-8)
- No duplicate attributes

If the XML is malformed, report the syntax error with the line number and stop here — schema validation cannot proceed on broken XML.

### Step 3: Validate Against XSD Schema

Use Python with `lxml` to validate against the official DDEX XSD schema hosted at `service.ddex.net`:

```python
from lxml import etree
import requests

def validate_ddex(xml_content: str, version: str) -> dict:
    """Validate DDEX XML against official ERN schema."""
    xsd_url = (
        f"https://service.ddex.net/xml/ern/"
        f"{version}/release-notification.xsd"
    )

    # Fetch and compile schema
    response = requests.get(xsd_url, timeout=10)
    response.raise_for_status()
    schema_root = etree.fromstring(response.content)
    schema = etree.XMLSchema(schema_root)

    # Parse and validate
    xml_tree = etree.fromstring(xml_content.encode())
    is_valid = schema.validate(xml_tree)

    errors = []
    if not is_valid:
        for error in schema.error_log:
            errors.append({
                "line": error.line,
                "column": error.column,
                "message": error.message,
                "level": error.level_name,
            })

    return {"valid": is_valid, "errors": errors, "version": version}
```

### Step 4: Check Music Industry Requirements

Beyond schema validation, check these common issues that cause distributor rejections:

**Required identifiers:**
- `ISRC` must be exactly 12 alphanumeric characters (e.g., `USSM12345678`). No hyphens in XML — hyphens are display-only
- `ICPN` (UPC/EAN) must be 12 or 13 digits
- `MessageId` and `MessageThreadId` must be present and non-empty

**Required metadata:**
- `MessageSender` with valid `PartyId` (format: `PADPIDA` + identifier)
- At least one `MessageRecipient` with valid `PartyId`
- `MessageCreatedDateTime` in ISO 8601 format
- At least one `SoundRecording` in `ResourceList`
- At least one `Release` in `ReleaseList`
- Every `ReleaseResourceReference` must match a `ResourceReference` in `ResourceList`

**Territory and rights:**
- `TerritoryCode` must be valid ISO 3166-1 alpha-2 (e.g., `US`, `GB`) or `Worldwide`
- `ParentalWarningType` should be present (`NotExplicit`, `Explicit`, `Unknown`)
- `PLine` and `CLine` with `Year` and text content

**Audio technical details:**
- `AudioCodecType` specified (FLAC, WAV, MP3, AAC)
- `SamplingRate` and `BitRate` present for audio resources
- `HashSum` with `MD5` or `SHA1` algorithm for file integrity
- `Duration` in ISO 8601 format (e.g., `PT3M30S`)

### Step 5: Report Results

**If valid:**
```
DDEX ERN {version} — Valid

Summary:
- Releases: {count}
- Sound Recordings: {count}
- Images: {count}
- Territory: {territory}
- Message Type: {control_type}
- Sender: {sender_name}
- Recipient(s): {recipient_names}
```

**If errors found:**
```
DDEX ERN {version} — {error_count} error(s) found

| # | Line | Error | Suggested Fix |
|---|------|-------|---------------|
| 1 | 45   | Element 'ISRC': '' is not valid | Add 12-char ISRC code: CCXXXYYNNNNN |
| 2 | ... | ... | ... |
```

For each error, always suggest a specific fix. Do not just echo the raw schema error message — translate it into actionable guidance.

## Common Issues

### Missing Namespace Declaration
**Error:** "no matching global declaration available for the validation root"
**Fix:** Ensure the root element has `xmlns:ern="http://ddex.net/xml/ern/{VERSION}"` and `xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"` with a matching `xs:schemaLocation`.

### ISRC Format Errors
**Valid:** `USSM12345678` (12 characters, no hyphens)
**Invalid:** `US-SM1-23-45678` (hyphens are for human display only, never in XML)

### Resource Reference Mismatch
Every `ReleaseResourceReference` in `ReleaseList` must have a matching `ResourceReference` in `ResourceList`. Check for typos — references are case-sensitive (`A1` is not `a1`).

### Territory Code Issues
Use ISO 3166-1 alpha-2 codes (`US`, `GB`, `DE`) or `Worldwide` for global releases. Full country names like `United States` are not valid.

### Empty SubGenre Element
`` is valid but some distributors reject it. If no sub-genre applies, omit the element entirely rather than including an empty one.

### Missing DealList
While technically optional in the ERN schema, most DSPs require a `DealList` section specifying commercial terms (streaming, download, pricing). Warn the user if it's missing.

## Reference

Consult `references/ern-structure.md` for the complete ERN element hierarchy, field formats, and version differences between ERN 3.8.2 and 4.1.1+.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [musictechlab](https://github.com/musictechlab)
- **Source:** [musictechlab/ddex-validate](https://github.com/musictechlab/ddex-validate)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-musictechlab-ddex-validate-ddex-validate
- Seller: https://agentstack.voostack.com/s/musictechlab
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
