SubtitleEdit/subtitleedit · error · Exception

{e.Message}

Error message

{e.Message}

What it means

Thrown by DCinemaSmpte2014.ValidationCallBack during ToText export when the generated DCinema XML fails validation against SMPTE-428-7-2014-DCST.xsd. Identical mechanism to the 2007/2010 variants: a ValidationEventArgs message is re-thrown as a bare Exception. The 2014 schema adds further constraints on top of 2010.

Solutions

  1. Read e.Message in the exception to identify the precise schema rule and element.
  2. Add the missing 2014-specific attributes/elements (language, Region, etc.).
  3. If 2014 features are not needed, export using the 2010 or 2007 profile.
  4. Cross-check with an external SMPTE 428-7-2014 XSD validator.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate against SMPTE-428-7-2014-DCST.xsd with a collecting handler
var schemas = new XmlSchemaSet();
schemas.Add(null, "SMPTE-428-7-2014-DCST.xsd");
var settings = new XmlReaderSettings { ValidationType = ValidationType.Schema, Schemas = schemas };
var errors = new List<string>();
settings.ValidationEventHandler += (s, e) => errors.Add(e.Message);

Try / catch

try
{
    var text = format.ToText(subtitle, title);
}
catch (Exception ex) when (ex.Message.Contains("validation"))
{
    logger.Error(ex, "DCinema 2014 validation failed");
}

Prevention

When it happens

Trigger: Exporting to DCinema 2014 XML whose content violates the 2014 schema — additional required attributes, stricter time code or language rules, or Font/Region constraints not present in earlier versions.

Common situations: Subtitles without the newer required metadata (e.g. Region dimensions, language tags); content targeting the 2010 or 2007 profile that does not satisfy 2014 additions.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/1b03ab3ec881e46c. Report an issue: GitHub.

Appendix: source

Thrown at src/libse/SubtitleFormats/DCinemaSmpte2014.cs:604

                    xmld.LoadXml(result);
                    using (var xr = XmlReader.Create(zip))
                    {
                        xmld.Schemas.Add(null, xr);
                        xmld.Validate(ValidationCallBack);
                    }
                }
                catch (Exception exception)
                {
                    Errors = "Error validating xml via SMPTE-428-7-2014-DCST.xsd: " + exception.Message;
                }
            }

            return DCinemaSmpte2010.FixDcsTextSameLine(result);
        }

        private void ValidationCallBack(object sender, ValidationEventArgs e)
        {
            throw new Exception(e.Message);
        }

        public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
        {
            _errorCount = 0;
            var sb = new StringBuilder();
            lines.ForEach(line => sb.AppendLine(line));
            var xml = new XmlDocument { XmlResolver = null };
            xml.LoadXml(sb.ToString().Replace("<dcst:", "<").Replace("</dcst:", "</").Replace("xmlns=\"http://www.smpte-ra.org/schemas/428-7/2014/DCST\"", string.Empty)); // tags might be prefixed with namespace (or not)... so we just remove them

            var ss = Configuration.Settings.SubtitleSettings;
            try
            {
                ss.InitializeDCinemaSettings(true);
                XmlNode node = xml.DocumentElement.SelectSingleNode("Id");
                if (node != null)
                {
                    ss.CurrentDCinemaSubtitleId = node.InnerText;

View on GitHub (pinned to 17a9f07487)