<!--
    XML for Ad Insertion.

    Version 1.00, Sept.15, 2000
    Copyright (c) 2000 adXML.org. All rights reserved.

    Authors: Barclay R. Jiang, Mediaplex, Inc.
                Greg Casey, Engage, Inc.
-->
<!--
    Define some commonly used entities
-->
<!ENTITY % boolean "(0 | 1)">
<!-- 0 is false 1 is true -->
<!ENTITY % string "CDATA">
<!-- The ISO 3166 country code -->
<!ENTITY % isoCountryCode "CDATA">
<!-- Different advertising domains -->
<!ENTITY % adDomain "(online | wireless | tv | radio | print | outdoor | itv)">

<!--
    [A] Transport level adXML message envelope.

-->
<!ELEMENT adXML (Header, (Request | Response))>
<!ATTLIST adXML
    version CDATA "1.00"
    id CDATA #REQUIRED
    timestamp CDATA #REQUIRED
>
<!-- header -->
<!ELEMENT Header (From, To)>
<!ELEMENT From (Identity, Authentication?, HandlerURI?)>
<!ELEMENT To (Identity, HandlerURI?)>
<!ELEMENT Identity (#PCDATA)>
<!ELEMENT Authentication (Credential | DigitalSignature)>
<!--
    Some type of credential, which is typically a username/password type of
    secret exchanged through a secure transport before communication can take
    place.
-->
<!ELEMENT Credential ANY>
<!--
    A digital signature. The recommended format is the XML-based signature standard from W3C.

    type
        The type of digital signature used.
-->
<!ELEMENT DigitalSignature ANY>
<!ATTLIST DigitalSignature
    type CDATA "W3C XML Signature"
>

<!--
    HandlerURI may be used to specify the location of an adXML
    document handler. For example, this can be a URL of a receiver's
    Web server CGI program that processes incoming adXML documents.
-->
<!ELEMENT HandlerURI (#PCDATA)>


<!--
    [B] adXML Request for message body.

    Note that in most cases either Advertiser or Agency is specified, depending upon
    who the buyer is.

    Currently only online insertion orders are supported in the Request construct.
-->
<!ELEMENT Request (Advertiser?, Agency?, (InsertionOrder | CancellationOrder | ChangeOrder))>
<!--
    [C] Contents in a request
-->
<!--
    A single advertiser can have multiple contact persons.
    A unique ID can optionally be specified for an agency.
-->
<!ELEMENT Advertiser (Company, Contact*, Extrinsic*)>
<!ATTLIST Advertiser
    id CDATA #IMPLIED
>
<!ELEMENT Company (Name, Address?, Email*, Phone*, URL?)>
<!--
    A contact object can have type information, e.g. SalesPerson, etc.
-->
<!ELEMENT Contact (Name, Title?, Division?, Address?, Phone+, Email*, Extrinsic*)>
<!ATTLIST Contact
    type CDATA #IMPLIED
>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Division (#PCDATA)>

<!--
    Address represents a physical mailing address.
-->
<!ELEMENT Address (Street, City, (State | Province), Country, PostalCode)>
<!ELEMENT Street (#PCDATA)>
<!ELEMENT City (#PCDATA)>
<!ELEMENT State (#PCDATA)>
<!ELEMENT Province (#PCDATA)>
<!ELEMENT Country (#PCDATA)>
<!ELEMENT PostalCode (#PCDATA)>
<!--
    The 'type' attribute allows for phone numbers for different purposes.
-->
<!ELEMENT Phone (PhoneNumber)>
<!ATTLIST Phone
    type (work | home | mobile | fax) #REQUIRED
>
<!ELEMENT PhoneNumber (CountryCode?, AreaOrCityCode, Number, Extension?)>
<!ELEMENT CountryCode (#PCDATA)>
<!ATTLIST CountryCode
    isoCountryCode %isoCountryCode; #REQUIRED
>
<!ELEMENT AreaOrCityCode (#PCDATA)>
<!ELEMENT Number (#PCDATA)>
<!ELEMENT Extension (#PCDATA)>
<!ELEMENT Email (#PCDATA)>
<!ELEMENT URL (#PCDATA)>
<!--
    A single ad agency can have multiple contact persons.
    A unique ID can optionally be specified for an agency.
-->
<!ELEMENT Agency (Company, Contact*, Extrinsic*)>
<!ATTLIST Agency
    id CDATA #IMPLIED
>
<!--
    [D] Insertion orders. 'InsertionOrder' can be used for different advertising media
    types, such as on-line, radio, print, etc.

    orderId
        represents a unique ID for the order which must be present.

    revision
        optional field that can be used to track different versions of a contract.

    typeOfBuy
        flag that indicates whether the IO is for bonus or not.

    buyerStatus
        Publisher's categorization of the buyer.

    Currently only online placements are supported. More can be added later.
-->
<!ELEMENT InsertionOrder (Publisher, Description?, Contract?, (OnlineAdPlacement)+,
    TermsAndConditions?, Payment?, Extrinsic*)>
<!ATTLIST InsertionOrder
    orderId CDATA #REQUIRED
    revision CDATA #IMPLIED
    typeOfBuy (bonus | paid) #IMPLIED
    buyerStatus (preferred | firstTime | approved | pendingCredit) #IMPLIED
>
<!--
    Class that represents either a publisher or a representative of a publisher.
-->
<!ELEMENT Publisher (Company, Contact*)>
<!ATTLIST Publisher
    type (website | websiteNetwork | station | network | syndicator | localCableSupplier) #REQUIRED
>
<!--
    An Extrinsic is an element which can be used to extend the data
    associated with known elements. This construct is used to extend
    adXML to contain any standard extension that is proprietary to a 3rd party
    company.

    Since this Element is of type ANY, it could contain any arbitrary XML
    document within itself, or a binary ![CDATA[]] (i.e. CDATA section) document.

    name
        Name used to identify this extrinsic.
-->
<!ELEMENT Extrinsic ANY>
<!ATTLIST Extrinsic
    name CDATA #REQUIRED
>
<!--
    The revision number can be used to track individual revisions of contracts.
   
    Currently only on-line contract data is supported. New contract data types
    may be added later.
-->
<!ELEMENT Contract (StartDate?, EndDate?, Commission?, Net?, Gross?, TotalEstimatedCost?,
    (OnlineContractData), Extrinsic*)>
<!ATTLIST Contract
    revision CDATA #IMPLIED
>
<!ELEMENT Commission (Money)>
<!ELEMENT Net (Money)>
<!ELEMENT Gross (Money)>
<!ELEMENT TotalEstimatedCost (Money)>
<!--
    Money is the representation of the object used to pay for services.

    currency
        specifies the currency in which amount is stated, must conform to ISO
        4217 currency codes.

    alternateAmount
        the amount of money in the alternateCurrency. Optional and used to
        support dual-currency requirements such as the Euro.

    alternateCurrency
        specifies the currency in which the alternateAmount is stated, must
        conform to ISO 4217 currency codes.
-->
<!ELEMENT Money (#PCDATA)>
<!ATTLIST Money
    currency CDATA #REQUIRED
    alternateAmount CDATA #IMPLIED
    alternateCurrency CDATA #IMPLIED
>

<!--
    The terms and conditions text between the sender and receiver can
    go here.
-->
<!ELEMENT TermsAndConditions (#PCDATA)>

<!--
    Payment
-->
<!ELEMENT Payment EMPTY>
<!ATTLIST Payment
    method (creditCard | preApproved) #REQUIRED
>
<!--
    Contract at the placement level.
-->
<!ELEMENT PlacementContract (OnlineContractData, Extrinsic*)>
<!--
    Contract data for on-line ad campaigns.
-->
<!ELEMENT OnlineContractData (Impressions?, Clicks?, BonusImpressions?, BonusClicks?,
    FlatRate?, Extrinsic*)>
<!-- Cost structure -->
<!ELEMENT Impressions (Total, Cost)>
<!ELEMENT Clicks (Total, Cost)>
<!ELEMENT BonusImpressions (Total, Cost)>
<!ELEMENT BonusClicks (Total, Cost)>
<!ELEMENT FlatRate (Cost)>
<!ELEMENT Total (#PCDATA)>
<!ELEMENT Cost (Money, Per?)>
<!ELEMENT Per (#PCDATA)>
<!ELEMENT Id (#PCDATA)>
<!--
    [E] ad placement.

    placementId
        unique ID for a specific placement.

    action
        "new" = adding a new placement.
        "change" = changing an existing placement; used in ChangeOrder.
        "delete" = removing a placement; used in ChangeOrder
-->
<!ELEMENT OnlineAdPlacement (Description?, StartDate?, EndDate?, PlacementContract?,
    Targeting?, InsertionData?, Extrinsic*)>
<!ATTLIST OnlineAdPlacement
    placementId CDATA #REQUIRED
    action (new | change | delete) #REQUIRED
>
<!ELEMENT Description (#PCDATA)>
<!--
    A generic date object. ISO 8601 is recommended as the timestamp string.
-->
<!ELEMENT Date EMPTY>
<!ATTLIST Date
    timestamp CDATA #REQUIRED
>
<!--
    Campaign start date and end date.
-->
<!ELEMENT StartDate (Date)>
<!--
    A firm end date means that the flight ends on the specifed date regardless
    of the outcomeo of a campaign.
-->
<!ELEMENT EndDate (Date)>
<!ATTLIST EndDate
    type (soft | firm) #REQUIRED
>
<!ELEMENT Rate (PriceModel, Cost)>
<!ELEMENT PriceModel (#PCDATA)>

<!--
    Campaign targeting information.
-->
<!ELEMENT Targeting (TargetingCriteria)>
<!ATTLIST Targeting
    name CDATA #REQUIRED
    id CDATA #IMPLIED
>
<!--
    A TargetingCriteria can act as a grouping element to allow for
    multiple targeting elements and nesting, connector by the logical
    operators 'and' and 'or'.

    Each of the targeting criterion element has a set of operators that apply
    to it. The operators are defined as follows:

    'in' : a test of whether a value belongs to a set of values.
    'notIn' : a test of whether a value doesn't belong to a set of values.
    'like' : a test of whether a string value matches a string with
        wildcards. For example, strings such as "shop", "shopping", and "shops"
        match "shop%".
    'notLike' : a test of whether a string value doesn't match a string with
        wildcards.
    'equalTo' : a test of whether a value is equal to a given value.
    'notEqualTo' : a test of whether a value is not equal to a given value.
    'greaterThan' : a test of whether a value is greater than a given value.
    'lessThan' : a test of whether a value is less than a given value.
    'greaterThanOrEqualTo' : a test of whether a value is greater than or equal
        to a given value.
    'lessThanOrEqualTo' : a test of whether a value is less than or equal to
        a given value.

    If multiple string values need to be listed as content values (e.g. Domain,
    DayOfWeek, etc.) separate them by a comma ',' with no spaces in between.

-->
<!ELEMENT TargetingCriteria (TargetingCriteria | UserAgent | Domain | IPAddress |
    OS | AffinityGroups | Geographical | Keywords | SIC | UserData | DayOfMonth |
    DayOfWeek | TimeOfDay | Extrinsic)*>
<!ATTLIST TargetingCriteria
    connector (and | or) #REQUIRED
>
<!--
    UserAgent represents a Web browser program. The value of the content here
    may be something like "IE5.0" or "Netscape Communicator 4.5", etc.
-->
<!ELEMENT UserAgent (#PCDATA)>
<!ATTLIST UserAgent
    operator (like | notLike) #REQUIRED
>
<!--
    Targeting based on viewer's Internet domain information.
        name: e.g., AOL, CompuServe, etc.
        type: domain suffix.
-->
<!ELEMENT Domain (#PCDATA)>
<!ATTLIST Domain
    operator (in | notIn | like | notLike | equalTo | notEqualTo) #IMPLIED
>
<!-- IP address or machine host names -->
<!ELEMENT IPAddress (#PCDATA)>
<!ATTLIST IPAddress
    operator (like | notLike | equalTo | notEqualTo) #IMPLIED
>
<!ELEMENT OS (#PCDATA)>
<!ATTLIST OS
    operator (in | notIn | like | notLike | equalTo | notEqualTo) #IMPLIED
>
<!ELEMENT AffinityGroups (#PCDATA)>
<!ATTLIST AffinityGroups
    operator (like | notLike | in | notIn) #REQUIRED
>
<!--
    Targeting based on geographical information.
-->
<!ELEMENT Geographical EMPTY>
<!ATTLIST Geographical
    state CDATA #IMPLIED
    province CDATA #IMPLIED
    country CDATA #IMPLIED
    zipcode CDATA #IMPLIED
    postalcode CDATA #IMPLIED
    areaOrCityCode CDATA #IMPLIED
    operator (like | notLike | equalTo | notEqualTo) #REQUIRED
>
<!-- Keyword matching -->
<!ELEMENT Keywords (#PCDATA)>
<!ATTLIST Keywords
    operator (in | notIn | like | notLike | equalTo | notEqualTo) #REQUIRED
>
<!-- Industry Standard Code -->
<!ELEMENT SIC (#PCDATA)>
<!ATTLIST SIC
    operator (in | notIn | like | notLike | equalTo | notEqualTo) #REQUIRED
>
<!--
    UserData provides a general way for specifying name-value pair,
    e.g., OwnCar=Ford or Gender=female, etc.
-->
<!ELEMENT UserData (#PCDATA)>
<!ATTLIST UserData
    name CDATA #REQUIRED
    operator (in | notIn | like | notLike | equalTo | notEqualTo | greaterThan | lessThan | greaterThanOrEqualTo |

        lessThanOrEqualTo) #REQUIRED
>
<!--

    Time-based targeting.

    1) 'DayOfMonth': Content value can contain any combination of values from: 1, 2, 3, ..., 31,
            where 1=1st 2=2nd, etc. Multiple numbers should be separated by a ','.
    2) 'DayOfWeek': Content value can contain any combination of values from: 0, 1, 2, ..., 6,
            where 0=sunday and 6=saturday (US standard). Multiple numbers should be separated
            by a ','.
    3) 'TimeOfDay': Content value is the exact time. ISO 8601 is required for the time strings.

-->
<!ELEMENT DayOfMonth (#PCDATA)>
<!ATTLIST DayOfMonth
    operator (in | notIn | before | after | between) #REQUIRED
>
<!ELEMENT DayOfWeek (#PCDATA)>
<!ATTLIST DayOfWeek
    operator (in | notIn | before | after | between) #REQUIRED
>
<!ELEMENT TimeOfDay (#PCDATA)>
<!ATTLIST TimeOfDay
    operator (before | after | between) #REQUIRED
>

<!--
    [F] Insertion data block. This construct can be used for all domains.

    The creative set contains one or more creatives. Each of the creatives
    can contain either an URL or the actual creative. Note that 3rd party
    ad serving can be specified here as well by using CreativeURL and
    ClickthruURL.

    The Extrinsic construct allows for the inclusion of any proprietary
    extensions.
-->
<!ELEMENT InsertionData (CreativeSet, Extrinsic*)>
<!ATTLIST InsertionData
    type %adDomain; #REQUIRED
>
<!-- Creatives -->
<!ELEMENT CreativeSet (Creative*)>
<!ELEMENT Creative (Name, Size?, (CreativeURL | CreativeFile)?, CreativeData?, ClickthruURL, AltText?,

    Notes?, Extrinsic*)>
<!ATTLIST Creative
    mimeType    CDATA #REQUIRED
>
<!ELEMENT Size EMPTY>
<!ATTLIST Size
    width CDATA #REQUIRED
    height CDATA #REQUIRED
>

<!-- The creative can be retrieved from the URL -->
<!ELEMENT CreativeURL (#PCDATA)>

<!--
    The creative is included directly in the document. The map files can
    be used for specifying image maps.
-->
<!ELEMENT CreativeFile (FileName, CreativeData, MapFileName?, MapData?)>
<!ELEMENT FileName (#PCDATA)>
<!ELEMENT CreativeData (#PCDATA)>
<!ATTLIST CreativeData
    encoding CDATA "Base64"
    length CDATA #REQUIRED
>
<!ELEMENT MapFileName (#PCDATA)>
<!ELEMENT MapData (#PCDATA)>
<!ATTLIST MapData
    encoding CDATA "Base64"
    length CDATA #REQUIRED
>


<!ELEMENT ClickthruURL (#PCDATA)>
<!ELEMENT AltText (#PCDATA)>
<!ELEMENT Notes (#PCDATA)>

<!--
    [G] Order cancellation. This cancels the entire order.

    orderId
        ID of the original insertion order.
-->
<!ELEMENT CancellationOrder (Publisher, StartDate, EndDate, DateOfNotice,
    DateOfCancellation, ApprovedBy?, Extrinsic*)>
<!ATTLIST CancellationOrder
    orderId CDATA #REQUIRED
>
<!ELEMENT DateOfNotice (Date)>
<!ELEMENT DateOfCancellation (Date)>
<!ELEMENT ApprovedBy (Contact)>
<!--
    [H] Change order. Individual placements can be either changed or deleted.

    orderId
        ID of the original insertion order.

    Currently only online insertions are supported.
-->
<!ELEMENT ChangeOrder (Publisher, (OnlineAdPlacement)+, ApprovedBy?, Extrinsic*)>
<!ATTLIST ChangeOrder
    orderId CDATA #REQUIRED
>
<!--
    [I] Response for adXML requests for the transport layer.

    A response contains a status object which indicates either success or failure
    of a Request operation at the transport layer.

    A response can optionally contain an application layer response describing more
    detailed information about the response information for the original request.
    Currently only InsertionOrderResponse is supported. More types should be
    added later.

    code
        HTTP or cXML-specific status code. This shall follow the HTTP status code
        mechanism very closely, with 200 being request successful, etc.

    text
        Textual version of the status code. This is to aid human readability in logs.

-->
<!ELEMENT Response (Status, OrderResponse, Extrinsic*)>
<!ELEMENT Status EMPTY>
<!ATTLIST Status
    code CDATA #REQUIRED
    text CDATA #REQUIRED
>
<!--
    OrderId is the ID of the original insertion order.

    action indicates the decision made by the receiver for the
    the order.
-->
<!ELEMENT OrderResponse (OrderId, Reason?, Extrinsic*)>
<!ATTLIST OrderResponse
    action (accept | reject | negotiation) #REQUIRED
>
<!ELEMENT OrderId (#PCDATA)>
<!ELEMENT Reason (#PCDATA)>