Preambles for XML-based DDEX messages

All XML files based on an XML Schema Definition (XSD) have a "preamble". This preamble points to the XSD that is used to validate the XML file. This also applies to all XML based DDEX messages and files.

Below is a valid preamble for a NewReleaseMessage created in accordance for ERN 4.1.1:

<?xml version="1.0" encoding="UTF-8"?>
<ern:NewReleaseMessage 
	xmlns:ern="http://ddex.net/xml/ern/411"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ddex.net/xml/ern/411
                        http://ddex.net/xml/ern/411/release-notification.xsd" 
	LanguageAndScriptCode="en"> 

The six lines contain the following information:

  1. The XML version and encoding used. This should, in virtually all cases, be "1.0" and "UTF-8". 
    This line must be the very first line in the XML file and should always be as shown above.

  2. The tag name of the message (here: "NewReleaseMessage") with a namespace prefix (here: "ern").  
    This line states that the full namespace for for the namespace prefix "ern" is "http://ddex.net/xml/ern/411".  While this full namespace looks like a URL that points to a web resource, it is, actually, not; it is a URI (Uniform Resource Identifier) that identifies the XSD.
    The prefix can be any valid XML token but but must remain the same in the rest of the preamble.

  3. The XML namespace definitions (xmlns) for all tags in that message. 
    This is the namespace of the DDEX standard you are trying to work with and is referenced in the text of the standard (in ERN 4.1.1 it is in Clause 6.1, for instance.

  4. The XML namespace definitions for XML Schema itself.

  5. The location of the XSD file for the namespace that defines the elements of the DDEX message you are trying to work with. The XSD file for the namespace defined in line 3  can be found at "http://ddex.net/xml/ern/411/release-notification.xsd".

  6. Any XML attributes that the DDEX-defined message needs (here: "LanguageAndScriptCode").

The preamble above points to an XSD file hosted on a DDEX Server. It can also point to a file in your local hard drive, In that case that line would be, for instance:

xsi:schemaLocation="http://ddex.net/xml/ern/411 
                    file:../xsd/ern/release-notification.xsd" 

There is no need to reference any other XML schema definition files (e.g. the ones containing the allowed value sets) as these XSD files are imported by the main XSD file.