<?xml version="1.0" encoding="UTF-8"?>
<!-- 
Version 4 (2009-05-28)
Updated 'Rules' text to improve clarity.
Updated namespaces to reference AdsMLMaterials 2.5.
Version 3 (2008-03-28)
Updated from AdsML Type Library 2.0 AS to use 2.0 PS.
Version 2 (2007-10-10)
Updated from AdsMLMaterials 1.0 AS to use 2.0 PS.
Version 1 (2007-04-16)
Note: A schema location is provided in this sample, but must not be used in production messages.

AdsML User Extension Schema example

RULES FOR CREATING A USER EXTENSION SCHEMA

For documentation of how to create a user extension schema see the AdsML Framework document "E-Commerce Usage Rules & Guidelines", Section 'Creating a user extension schema'.
-->
<!-- 
SCENARIO: A User Extension Schema for AdsMLMaterials to allow the use of publisher-specific values in artwork messages sent between an artwork provider (creative services) and a publisher (NY Herald). User extensions are made to create (1) additional delivery metadata properties, specifying these as User Defined Properties (UDP) using the adsml:Properties extension mechanism, and (2) a specific set of color codes. 

Creating the extension schema:

(1) An import statement for the main schema of the AdsML Framework standard for which the user extension is being created is added.  In this example, the AdsMLMaterials Main Schema. This allows the user extension schema to be used for XML Schema validation of an instance XML file using the user-defined values if required. 

(2)  Import statement(s) are added for the AdsML Framework Schema whose structures will be restricted to create the user extensions. Namely, the AdsML Type Library and the AdsML Controlled Vocabulary schema files. 

Importing the AdsML Type Library allows user-defined properties (UDP) to be created based on the adsml:PropertyRootType, and controlled vocabularies to be created based on the adsml:CodeRootType.

Importing the AdsML Controlled Vocabularies allows user-defined extensions or erestrictions of existing AdsML defined controlled vocabularies (CV).

(3)  Namespace declarations (using 'xmlns' attributes) are added to the root xs:schema element for the AdsML schemas that have been imported in steps (1) and (2) above.

For example, when creating an extension for AdsMLMaterials, xmlns attributes are added for,
	- xmlns:adsml-ma="http://www.adsml.org/adsmlmaterials/2.0" 
	- xmlns:adsml="http://www.adsml.org/typelibrary/2.0" 
	- xmlns:adsml-cv="http://www.adsml.org/controlledvocabularies/3.0"

(4)  Namespace declarations  (using 'xmlns' attributes) are added to the root xs:schema element for the user extension schema using 'targetNamespace' and 'xmlns' attributes. Optionally, the user extension namespace is also associated with a namespace prefix using a second 'xmlns' attribute. In this example, the user-extension namespace is 'http://www.nyherald.com/adsml-extensions'.

By doing this, the extensions are defined in the namespace of the user.

(5) The user-defined values are specified.  In this example, delivery metadata properties and user-defined Color codes are defined.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:adsml="http://www.adsml.org/typelibrary/2.0" xmlns:adsml-ma="http://www.adsml.org/adsmlmaterials/2.5" xmlns:adsml-cv="http://www.adsml.org/controlledvocabularies/3.0" xmlns="http://www.nyherald.com/adsml-extensions" xmlns:nyherald="http://www.nyherald.com/adsml-extensions" targetNamespace="http://www.nyherald.com/adsml-extensions" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!-- Import statements for the schema:
(1) The AdsML Framework schema being restricted to create the user extensions are imported. In this example, the AdsML Type Library and AdsML Controlled Vocabulary schema files.
(2) The AdsML Framework schema where the user extensions will be used is imported. In this example, the AdsML Materials main schema.

Note: this is the minimal schema import.  Explicit imports are only needed for the schema whose structures are being restricted and for the main schema in which the user extensions are to be used. These schema themselves include or import the other AdsML Framework schema.  
-->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:import namespace="http://www.adsml.org/typelibrary/2.0" schemaLocation="../../schemas/AdsMLTypeLibrary-2.0-AS.xsd"/>
	<xs:import namespace="http://www.adsml.org/controlledvocabularies/3.0" schemaLocation="../../schemas/AdsMLControlledVocabularies-3.0-AS.xsd"/>
	<xs:import namespace="http://www.adsml.org/adsmlmaterials/2.5" schemaLocation="../../schemas/AdsMLMaterials-2.5-Main-AS.xsd"/>
	<!-- A user-defined property for a 'delivery flag' is defined with 2 values to identify a delivery as a 'push' or a 'pull'.  -->
	<xs:simpleType name="DeliveryFlag">
		<xs:restriction base="adsml:PropertyRootType">
			<xs:enumeration value="Pull"/>
			<xs:enumeration value="Push"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- A user-defined controlled vocabulary for color codes is defined. In this example the user wants to have a choice between 2 colors - 'black' or 'color'. In this example, this has been done by restricting the AdsML Color Type CV to just 2 of its original set ov values - that is to 'Black' and 'ProcessColor'. -->
	<xs:simpleType name="ColorTypesCV">
		<xs:restriction base="adsml-cv:AdsMLColorTypeCV">
			<xs:enumeration value="Black"/>
			<xs:enumeration value="ProcessColor"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

