Skip to main content

Parse output reference

The parser produces two views of a message:

  • the flat model, denormalized for easy use: releases with their tracks resolved, labels and artists looked up, dates and genres collected. Rust: ddex_core::models::flat::FlattenedMessage (message.flat). Node.js: the ParsedMessage returned by parse / parseSync (camelCase names; see index.d.ts). Python: the accessor methods of ParsedERNMessage and its DataFrames.
  • the graph model, the message structure as written (Rust only: message.graph, see below).

The field names below are the Rust ones; the Node.js name is the camelCase form shown in the tables. Python column names are listed on the DataFrames page.

Absent values​

The parser never invents a value. When the XML does not have a value:

Optional valueList
RustNoneempty Vec
Node.jsthe key is omitted (undefined)[]
PythonNone (in a DataFrame: pandas' missing value, see pandas 2 and 3)[]

Text is kept as written. Each value follows its XSD whiteSpace facet: strings keep their whitespace, and only token types such as references are collapsed. A present but empty element (<TitleText/>) is Some("") / "", not absent.

Message​

Rust (flat)Node.jsDescription
message_idmessageIdMessageHeader/MessageId
message_typemessageTypeThe root element, e.g. NewReleaseMessage
message_datemessageDateMessageCreatedDateTime (Rust DateTime<Utc>; Node.js an RFC 3339 string)
sender.name, sender.idsenderName, senderIdMessageSender PartyName/FullName (optional) and PartyId
recipient.name, recipient.idrecipientName, recipientIdMessageRecipient, the same way
versionversionThe ERN version enum's name: V3_8_1, V3_8_2, V4_2 or V4_3
profileprofileThe message profile, when one is recognized
message_control_typemessageControlTypeMessageHeader/MessageControlType as written (LiveMessage, TestMessage, ...); absent when the header has none
releasesreleasesSee Release
resourcesresourcesResources keyed by resource reference (A1, ...); see Resource
dealsdealsSee Deal
parties(not exposed)4.x PartyList parties keyed by party reference (graph Party values)
statsreleaseCount, trackCount, dealCount, totalDurationSecondsCounts; Node.js also has resourceCount

Python: message_id(), version(), release_count() and message_control_type() are methods; the header values are also the message row of to_dataframe("flat").

Release​

Rust (ParsedRelease)Node.js (JsRelease)Description
release_idreleaseIdThe ReleaseReference (R0, ...), the key deals use. The identifiers are below
identifiers.upcicpnReleaseId/ICPN
identifiers.gridgridReleaseId/GRid
identifiers.isrcisrcReleaseId/ISRC (3.8.x; 4.x has no release ISRC)
identifiers.proprietaryproprietaryIdsReleaseId/ProprietaryIds as { namespace, value }
default_titletitle, defaultTitle4.x DisplayTitleText, 3.8.x ReferenceTitle
title(not exposed)Every title as LocalizedString (text, language_code)
default_subtitlesubtitleThe first subtitle
display_artistdisplayArtist4.x DisplayArtistName, else the display artists' names
artists(not exposed)Display artists as { name, role, party_id }
release_typereleaseTypeReleaseType (Album, Single, ...; TrackRelease for a 4.3 main track release)
genre, sub_genregenre, subGenreThe default genre; see Genres
genresgenresEvery genre with its territory scope
parental_warningparentalWarningThe default ParentalWarningType
parental_warningsparentalWarningsEvery ParentalWarningType value in document order
label_namelabelNameSee Label
p_line, c_linepLine, cLineThe default P line and C line; see P and C lines
release_datereleaseDateThe default release date, only when it is a full YYYY-MM-DD date (Rust DateTime<Utc> at midnight UTC; Node.js RFC 3339)
release_datesreleaseDatesEvery release date as written; see Dates
original_release_date, original_release_datesoriginalReleaseDate, originalReleaseDatesThe same for OriginalReleaseDate
trackstracksSee Track
track_counttrackCountNumber of tracks
disc_countdiscCountNumber of discs, when the release has disc groups
territories(not exposed)The release's TerritoryCode / ExcludedTerritoryCode (3.8.x details blocks)

Releases are the message's Releases. In ERN 4.3 a message whose only release is a TrackRelease IsMainRelease="true" gets that track release as its release (with release_type TrackRelease and no display artist, which the XSD does not give it).

Track​

A track is a sound recording or video that the release lists, resolved against its resource (images and text are not tracks).

Rust (ParsedTrack)Node.js (JsTrack)Description
track_idtrackId, resourceReferenceThe resource reference (A1, ...)
isrcisrcThe resource's ISRC
titletitleThe resource's title (4.x DisplayTitleText, 3.8.x ReferenceTitle)
display_artistartistThe resource's display artist
artistsartistsDisplay artists with their roles: Rust { name, role, party_id }, Node.js { name, role, partyReference }
durationdurationRust std::time::Duration; Node.js the formatted m:ss string (2:28). Seconds are in resources[ref].durationSeconds
duration_formatted(duration)m:ss
positionposition1-based order of the track within its disc, or within the release when there are no discs
disc_numberdiscNumberSee Track layout
track_numbertrackNumberThe item's own SequenceNumber, as written
group_pathgroupPathEnclosing nested ResourceGroups, outermost first, as { group_type, sequence_number }
genre, sub_genregenre, subGenreThe resource's default genre (3.8.x; 4.x resources have none)
parental_warningparentalWarningThe resource's default ParentalWarningType
p_line, c_linepLine, cLineThe resource's default P line and C line
label_namelabelNameThe resource's default label name (3.8.x)
track_release_referencetrackReleaseReference4.x: see Track releases
track_release_idtrackReleaseId4.x
track_release_genre, track_release_sub_genretrackReleaseGenre, trackReleaseSubGenre4.x

Track layout​

  • disc_number (ERN 4.x): the SequenceNumber of the nearest enclosing Component group, else of the nearest ReleaseComponent group. MultiWorkPart and Side groups never set it. ERN 3.8.x: not read (always absent).
  • position: counts tracks from 1 within each disc, in document order (3.8.x: in the order of the release's ReleaseResourceReferenceList).
  • track_number: the item's SequenceNumber in the ResourceGroup, exactly as written (it can differ from position, or be absent).
  • group_path: every nested ResourceGroup between the release's top-level group and the track, outermost first, each with its ResourceGroupType and SequenceNumber. The top-level group itself is not included. Empty when the track sits directly in the top-level group.

Track releases​

ERN 4.x describes each track's own release as a TrackRelease. The flat model attaches it to the track:

FieldDescription
track_release_referenceThe TrackRelease's ReleaseReference. Deals reference track releases by this value, so it is how a deal's releases map to tracks
track_release_idThe first identifier of that TrackRelease's ReleaseId
track_release_genre, track_release_sub_genreThe TrackRelease's default genre

These are absent for ERN 3.8.x messages and for tracks without a TrackRelease.

Dates​

release_dates and original_release_dates hold every date as written, so partial dates survive:

FieldDescription
dateYYYY, YYYY-MM or YYYY-MM-DD, exactly as in the XML
is_approximateThe IsApproximate attribute, when present
territory scopeSee Territory scope

release_date / releaseDate is a convenience: the default date as a timestamp, set only when that date is a full YYYY-MM-DD. A release dated 2024 has release_dates[0].date == "2024" and no release_date.

P and C lines​

p_line and c_line are the default PLine and CLine:

Rust (Copyright)Node.js (JsCopyright)Description
texttextPLineText / CLineText as written (e.g. (P) 1994 EMI Music Japan Inc.)
yearyearYear
ownercompanyPLineCompany / CLineCompany
scopeterritoryCodes, isDefaultSee Territory scope

Genres​

genres lists every genre in document order as { genre, sub_genre } with its territory scope. genre / sub_genre on the release hold the default one: the first marked IsDefault, else the first that applies worldwide, else the first.

Parental warnings​

parental_warning is the default ParentalWarningType value (Explicit, NotExplicit, NoAdviceAvailable, ...), chosen the same way as the default genre; parental_warnings lists every value in document order. Tracks carry their resource's default warning.

Label​

label_name is the release's label: in ERN 3.8.x the default LabelName; in ERN 4.x the PartyList name of the party referenced by the first ReleaseLabelReference.

Territory scope​

Dates, genres, P and C lines and label names carry where they apply:

Rust (TerritoryScope)Node.jsDescription
territory_codesterritoryCodes4.x ApplicableTerritoryCode; 3.8.x the TerritoryCodes of the ...DetailsByTerritory block the value was read from
excluded_territory_codesexcludedTerritoryCodes3.8.x ExcludedTerritoryCodes of that block
is_defaultisDefault4.x IsDefault, when written
language_and_script_code(not exposed)The value's LanguageAndScriptCode

Only what the XML says is recorded: a value written directly on the release has an empty scope.

Deal​

Rust (ParsedDeal)Node.js (JsDeal)Python deals()Description
deal_iddealIddeal_idDealReference (optional in ERN)
releasesreleasesreleasesThe release references the deal applies to (R0, track releases R1, ...)
validity.start, validity.endstartDate, endDatestart_date, end_dateValidityPeriod StartDate / EndDate (Rust DateTime<Utc>; Node.js and Python RFC 3339, midnight UTC for a date)
territories.includedterritoriesterritoriesTerritoryCodes
territories.excluded(not exposed)excluded_territoriesExcludedTerritoryCodes
distribution_channels.included(not exposed)distribution_channelsDistribution channels
usage_rightsusageRightsusage_rightsThe use types
pricing(not exposed)(not exposed)Price tiers

Two caveats: with several ValidityPeriods in one deal the last start and end date win, and StartDateTime / EndDateTime are not read. Use types outside the parser's known list appear in their debug form (Other("ConditionalDownload")). The flat deal has no commercial model type (Node.js commercialModel is always absent).

Resource​

resources maps each resource reference to the resource:

Rust (ParsedResource)Node.js (JsResource)Description
resource_idresourceIdThe resource reference
resource_typeresourceTypeThe resource kind: SoundRecording, Video, Image, ... (not the DDEX Type value)
titletitleThe title, when the resource has one
durationdurationSeconds, durationStringRust Duration; Node.js seconds and m:ss
technical_detailsfileFormat, bitrate, sampleRate, fileSizeFrom the first technical details block
genre, sub_genre, parental_warning, p_line, c_line, label_namethe same in camelCaseThe resource's defaults, as on Track

Fields not filled in 0.5.0​

These Rust fields exist in the model but the parser does not fill them yet: on releases videos, images, cover_art, parent_release, child_releases, identifiers.ean and identifiers.catalog_number; on tracks iswc, subtitle, file_format, bitrate and sample_rate (the resource has them), and is_hidden, is_bonus, is_explicit and is_instrumental are always false (for explicit content use parental_warning); on deals restrictions (Node.js restrictions) is always empty.

Graph model (Rust)​

message.graph is a ddex_core::models::graph::ERNMessage: the message as written, with its references unresolved. Use it when you need something the flat model does not carry.

FieldDescription
message_headerMessageHeader: ID, sender, recipient, created date-time, control type
partiesERN 4.x PartyList
resourcesEvery resource (Resource): reference, kind, IDs, titles, display artists, duration, technical details, genres, parental warnings, P and C lines, label names
releasesReleases: reference, IDs, titles, type, genres, display artists, dates, labels, P and C lines, parental warnings, the ResourceGroup tree and the 3.8.x ReleaseResourceReferenceList
track_releasesERN 4.x TrackReleases, in document order (empty for 3.8.x)
dealsDeals with their DealTerms (territories, channels, commercial model types, use types, validity, prices)
versionERNVersion (V3_8_1, V3_8_2, V4_2, V4_3)
attributesThe root element's attributes (AvsVersionId, LanguageAndScriptCode, ...)
extensionsExtension elements and attributes that are not part of the ERN schema
use ddex_parser::DDEXParser;
use std::io::Cursor;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let message = DDEXParser::new().parse(Cursor::new(std::fs::read("release.xml")?))?;
let graph = &message.graph;

println!("ERN {}", graph.version.as_str());
for release in &graph.releases {
println!(
"{}: {} resource group(s), {} label reference(s)",
release.release_reference,
usize::from(release.resource_group.is_some()),
release.release_label_reference.len(),
);
}
for track_release in &graph.track_releases {
println!("track release {}", track_release.release_reference);
}
Ok(())
}

The full list of types and fields is on docs.rs/ddex-core.