ddn.data.xml.errors
Shared error types and location tracking.
Types 4
enumXmlErrorCode
Machine-readable error codes for XML parsing, validation, and serialization.
UNKNOWNUnspecified/unknown error.
UNEXPECTED_EOFAn unexpected end-of-input was encountered.
INVALID_ENCODINGInput is not valid UTF-8 (or violates XML character rules).
INVALID_NAMEA name (Name/NCName/QName) is invalid.
MISMATCHED_TAGStart/end tags do not match or nesting is invalid.
DOCTYPE_FORBIDDENA `DOCTYPE` declaration was rejected by options/policy.
ENTITY_EXPANSION_LIMITEntity expansion exceeded a safety limit.
DUPLICATE_ATTRIBUTEDuplicate attribute detected (same expanded name).
XML_DECLARATION_INVALIDXML declaration (`<?xml ...?>`) is malformed or invalid.
INVALID_CHARACTERAn invalid XML character (per the XML version's character constraints) was encountered.
EXTERNAL_SUBSET_FORBIDDENExternal subset loading was attempted but is not allowed/supported by policy.
EXTERNAL_SUBSET_IO_ERRORExternal subset loading failed due to an I/O error (missing file, read failure, etc.).
DOCTYPE_ROOT_MISMATCHDOCTYPE name does not match the document element name.
REQUIRED_ATTRIBUTE_MISSINGA required DTD attribute (`#REQUIRED`) is missing.
FIXED_ATTRIBUTE_MISMATCHA `#FIXED` DTD attribute is present with a value different from the fixed default.
ENUMERATION_ATTRIBUTE_MISMATCHA DTD enumerated attribute has a value not in its declared enumeration.
DTD_UNDECLARED_ELEMENTAn element appears in the document but has no DTD `<!ELEMENT ...>` declaration.
DTD_CONTENT_MODEL_VIOLATIONAn element's children/text violate its DTD element content model.
XPOINTER_SYNTAX_ERRORXPointer syntax error.
XPOINTER_UNSUPPORTED_SCHEMEXPointer scheme is not supported.
XPOINTER_NOT_FOUNDXPointer did not resolve to any node.
XPOINTER_INVALID_ELEMENT_SEQUENCEXPointer `element()` sequence is invalid.
DUPLICATE_IDDuplicate `ID` value detected during DTD validation.
UNRESOLVED_IDREF`IDREF`/`IDREFS` references a missing `ID`.
INVALID_ID_VALUEAn `ID` attribute value is not a valid XML `Name`.
INVALID_IDREF_VALUEAn `IDREF` attribute value is not a valid XML `Name`.
INVALID_NMTOKEN_VALUEAn `NMTOKEN` attribute value is not a valid XML `Nmtoken`.
INVALID_NMTOKENS_VALUEAn `NMTOKENS` attribute value contains an invalid `Nmtoken`.
UNDECLARED_ENTITY_VALUEAn `ENTITY` attribute value does not match a declared unparsed entity.
UNDECLARED_ENTITIES_VALUEAn `ENTITIES` attribute value contains a token that does not match a declared unparsed entity.
UNDECLARED_NOTATION_VALUEA `NOTATION` attribute value does not match a declared notation.
MULTIPLE_ID_ATTRIBUTESMultiple `ID` attributes are declared for the same element.
INVALID_ID_DEFAULTAn `ID` attribute has a default value (must be `#REQUIRED` or `#IMPLIED`).
XINCLUDE_FORBIDDENXInclude network/URI include is forbidden by policy.
XINCLUDE_IO_ERRORXInclude failed due to an I/O error (missing include file, etc.).
XINCLUDE_UNSUPPORTEDXInclude feature/syntax is not supported by the current implementation phase.
XINCLUDE_RECURSION_LIMITXInclude recursion limit exceeded.
INPUT_SIZE_LIMITInput XML size exceeded a safety limit.
RECURSION_LIMITElement nesting depth exceeded a safety limit.
ATTRIBUTE_COUNT_LIMITNumber of attributes on an element exceeded a safety limit.
NAME_LENGTH_LIMITLength of an XML name (element, attribute, etc.) exceeded a safety limit.
TEXT_LENGTH_LIMITLength of text content exceeded a safety limit.
ATTRIBUTE_VALUE_LENGTH_LIMITLength of an attribute value exceeded a safety limit.
NAMESPACE_COUNT_LIMITNumber of namespace declarations on an element exceeded a safety limit.
NODE_COUNT_LIMITTotal number of nodes in the document exceeded a safety limit.
EXTERNAL_RESOURCE_SIZE_LIMITSize of an external resource exceeded a safety limit.
structXmlLocation
Location of an error (or event) inside an XML input.
A location is considered unknown when all fields are left at their defaults.
Fields
ulong line1-based line number (0 means unknown).ulong column1-based column number (0 means unknown).ulong byteOffset0-based byte offset (0 means unknown).string systemIdOptional system identifier (e.g. filename, URL). Empty means unknown.structXmlError
Represents an XML-related error with a code and optional location/cause.
Fields
XmlErrorCode codeError code.string messageHuman-readable error message.XmlLocation locationOptional location.Throwable causeOptional underlying cause.Methods
Constructors
this(
XmlErrorCode code,
string message,
XmlLocation location = XmlLocation.init,
Throwable cause = null)Constructs an `XmlError`.classXmlException : Exception
Exception type used by ddn.data.xml for XML failures.
Design note: The library is exception-centric for error reporting: parsing/validation functions will throw XmlException on failure. This provides ergonomic stack traces and integrates naturally with D error handling, while still allowing callers to catch and inspect structured error data.
Fields
XmlError errorStructured error information.Methods