An XML Schema Definition (XSD) describes the valid structure of an XML document. The schema is the successor to the Document Type Definition (DTD), and is the current recommendation of the World Wide Web Consortium (W3C). Below are the XSD files associated with each document type in the NAMM B2B standard. These schemas should be used for validation when creating/modifying, sending, receiving, and reading/importing the XML documents in order to avoid transmitting an invalid document to, or receiving one from, another business partner.
The schemas as presented here do not use the optional targetNamespace attribute on the schema tag; they have only the xmlns:xs attribute, defining the “xs” prefix, like this:
Therefore, when referencing the schemas from a NAMM B2B XML data document, you should use the xsi:noNamespaceSchemaLocation attribute instead of the xsi:schemaLocation attribute on the top-level tag to specify the location of the schema.
For example, assume that the schemas all reside in a folder on the NAMM web site called http://b2b.namm.org/B2B/Schemas. If the schema for the Party document is named party-v2009.1.xsd, then the reference to it in the Party document’s top-level tag would look like this:
Such a reference would allow connection to and validation through the associated schema.
One additional coding note: Because the default value for both the minOccurs and maxOccurs attributes is “1”, minOccurs="0" has been included only when necessary, to indicate optional elements.
- Printer-friendly version
- Log in or register to post comments