[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1354
  • Last Modified:

Import a cXML document values into sql 2000 table

I am trying to import a cXML document into a sql 2000 table and so far I am having no success.
I am not too familiar with cXML so it has been difficult. How do I import the data from a cXML file into a SQL server 2000 database table? I would prefer to use T-SQL or VB.net. Please provide a code example. I have included the cXML file and the DTD file in the code section since I cannot upload the actual files because of the file restrictions.

<?xml version="1.0" encoding="UTF-8"?>
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/modules/Common.mod#6 $
-->

<!--
    A few character entities the XML recommendation says should be defined
    "for interoperability" with existing SGML parsers.  By default, these
    are not included to avoid warnings (about entity redefinition) from
    many XML parsers.
-->
<!ENTITY % SGML-help "IGNORE">
<![%SGML-help;[
<!ENTITY lt     "&#38;#60;">
<!ENTITY gt     "&#62;">
<!ENTITY amp    "&#38;#38;">
<!ENTITY apos   "&#39;">
<!ENTITY quot   "&#34;">
]]>

<!--
    Common types used throughout the cXML definition.

    The types try to follow the XML DATA definition submitted to the W3C. See
    the following for more information,

        http://msdn.microsoft.com/xml/reference/schema/datatypes.asp
        http://www.w3c.org/TR/1998/NOTE-XML-data-0105/

-->

<!-- Atomic-level Types -->
<!ENTITY % bin.base64 "CDATA">
<!ENTITY % bin.hex "CDATA">
<!ENTITY % boolean "(0 | 1)">    <!-- 0 is false, 1 is true -->
<!ENTITY % char "CDATA">
<!ENTITY % date "CDATA">
<!ENTITY % datetime.tz "CDATA">  <!-- Time zone is required -->
<!ENTITY % fixed.14.4 "CDATA">
<!ENTITY % i8 "CDATA">
<!ENTITY % int "%i8;">
<!ENTITY % r8 "CDATA">
<!ENTITY % number "CDATA">       <!-- No limit on number of digits, unlike
                                      %r8; -->
<!ENTITY % string "CDATA">
<!ENTITY % time.tz "CDATA">      <!-- Time zone is required -->
<!ENTITY % duration "CDATA">      <!--ISO8601 duration http://www.w3.org/TR/xmlschema-2/#duration  -->
<!ENTITY % ui8 "CDATA">
<!ENTITY % uint "%ui8;">         <!-- Unique to this specification -->
<!ENTITY % uri "CDATA">
<!ENTITY % uuid "CDATA">

<!-- Higher-level Types -->
<!--
    NOTE: The following is a temporary *hack* to allow empty values for
    some attributes with these types.  The nmtoken entity should resolve to
    NMTOKEN.
-->
<!ENTITY % nmtoken "CDATA">      <!-- Any combination of XML name chars. -->
<!ENTITY % isoLangCode "%nmtoken;">         <!-- ISO 639 Language Code -->
<!ENTITY % isoCountryCode "%nmtoken;">      <!-- ISO 3166 Country Code -->
<!ENTITY % isoCurrencyCode "%nmtoken;">     <!-- ISO 4217 Currency Code -->
<!ENTITY % xmlLangCode "%nmtoken;"> <!-- Language code as defined by XML
                                         recommendation: Language and
					 country. -->
<!ENTITY % URL "%uri;">
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/schema/Modules/Base.mod#8 $
-->

<!--
    This file defines the basic elements used to build higher level
    constructs in cXML.
-->

<!-- Basic Name/Data Elements -->
<!--
    Name is used to provide an identifier for other elements.

    xml:lang
        The language in which the name is written.
-->
<!ELEMENT Name (#PCDATA)> <!-- string -->
<!ATTLIST Name
    xml:lang  %xmlLangCode;  #REQUIRED
>

<!--
    An Extrinsic is an element which can be used to extend the data
    associated with known elements.

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

    name
        Name used to identify this extrinsic.
-->
<!ELEMENT Extrinsic ANY>
<!ATTLIST Extrinsic
    name  %string;  #REQUIRED
>

<!--
    Description is a string which describes something.
    Though text may be interspersed with ShortName elements in this content
    model, placing the ShortName at the beginning or end of the element is
    much preferred.  At most one ShortName element is allowed per
    Description.  The intended content model would be more like
    (( ShortName, #PCDATA ) | ( #PCDATA | ShortName? )) if DTD syntax
    supported it.

    xml:lang
        The language in which the description is written.
-->
<!ELEMENT Description ( #PCDATA | ShortName )* > <!-- mixed: string and
                                                      ShortName -->
<!ATTLIST Description
    xml:lang  %xmlLangCode;  #REQUIRED
>

<!--
    A short string which describes something in fewer characters than the
    entire Description.  This should be used when limited space is available.
    For example, a table of elements might show the ShortName's of each.  A
    linked "details" view would show the entire Description (including the
    ShortName).  Without a ShortName, the user interface must default to a
    truncation of the Description.
    This element does not require an xml:lang attribute since it appears only
    within a Description element.  The language of the ShortName must match
    that of the surrounding Description.
-->
<!ELEMENT ShortName (#PCDATA)> <!-- string -->

<!-- Telephone Number Elements -->
<!--
    International ITU dial code for the country code in question.  This
    code would be entered after any escape code necessary to begin
    International dialing.  That is, the escape code does not appear in the
    content of this element.

    isoCountryCode
        The ISO 3166 2-letter country code for the dial code in question.
-->
<!ELEMENT CountryCode (#PCDATA)> <!-- uint -->
<!ATTLIST CountryCode
    isoCountryCode  %isoCountryCode;  #REQUIRED
>

<!--
    The areacode or city code within a CountryCode.
-->
<!ELEMENT AreaOrCityCode (#PCDATA)> <!-- uint -->

<!--
    The local number part of a telephone number.
-->
<!ELEMENT Number (#PCDATA)> <!-- string -->

<!--
    An extension within relative to the Number element. This element has no
    meaning without an associated Number element.
-->
<!ELEMENT Extension (#PCDATA)> <!-- uint -->

<!--
    TelephoneNumber represents international telephone numbers.
-->
<!ELEMENT TelephoneNumber (CountryCode, AreaOrCityCode, Number, Extension?)>

<!--
     Phone is a "named" TelephoneNumber.

     name
          specifies an identifier which indicates the type of phone number.
          US examples would include "work","home", etc.
-->
<!ELEMENT Phone (TelephoneNumber)>
<!ATTLIST Phone
    name  %string;  #IMPLIED
>

<!--
    Fax number.
-->
<!ELEMENT Fax (TelephoneNumber | URL | Email)>
<!ATTLIST Fax
    name  %string;  #IMPLIED
>

<!-- Addressing Elements -->
<!--
    URL. A string which represents a URL
-->
<!ELEMENT URL (#PCDATA)> <!-- URL -->
<!ATTLIST URL
    name  %string;  #IMPLIED
>

<!--
    An email address. Address must conform to RFC 821 (SMTP Standard).

    preferredLang
        optional language that the email owner prefers to receive
        emails in. Refer to the definition of xmlLangCode entity.

-->
<!ELEMENT Email (#PCDATA)> <!-- string -->
<!ATTLIST Email
    name          %string;       #IMPLIED
    preferredLang %xmlLangCode;  #IMPLIED
>

<!--
    Contact represents an entity at a location. The nature of this
    element is that it represents a communication "end point" for a
    location.

    role
        Position this person or group plays in the procurement process.
        Likely values include endUser, administrator, purchasingAgent,
        technicalSupport, customerService, sales,
        supplierCorporate, supplierMasterAccount, supplierAccount,
        buyerCorporate, buyerMasterAccount, buyerAccount, buyer,
        subsequentBuyer. Other values may be allowed in some cases.

        from and to roles are reserved for future use.

    addressID
        An id for the address. Needed to support address codes for
        relationships that require id references.
-->
<!ELEMENT Contact (Name, PostalAddress*, Email*, Phone*, Fax*, URL*)>
<!ATTLIST Contact
    role             NMTOKEN           #IMPLIED
    addressID        %string;          #IMPLIED
>

<!--
    The DeliverTo part of an Address. This would be internal to the actual
    address know to the outside world. Similar to what an extension is to a
    TelephoneNumber.
-->
<!ELEMENT DeliverTo (#PCDATA)> <!-- string -->

<!--
    Street is a single line of an Address' location.
-->
<!ELEMENT Street (#PCDATA)> <!-- string -->

<!--
    City is the name of the city in an Address' location.
-->
<!ELEMENT City (#PCDATA)> <!-- string -->

<!--
    State is an optional state identifier in an Address' location.
-->
<!ELEMENT State (#PCDATA)> <!-- string -->

<!--
    PostalCode (I have no idea how to describe it)
-->
<!ELEMENT PostalCode (#PCDATA)> <!-- string -->

<!--
    Country is the name of the country in an Address' location.  The
    content of this element is a string which may (for example) be printed
    directly to a shipping label.  The content is the human-readable
    equivalent of the isoCountryCode used by applications.

    isoCountryCode
        The ISO 3166 2-letter country code for this country.
-->
<!ELEMENT Country (#PCDATA)> <!-- string -->
<!ATTLIST Country
    isoCountryCode  %isoCountryCode;  #REQUIRED
>

<!--
    PostalAddress is a real-world location for a business or person.
-->
<!ELEMENT PostalAddress (DeliverTo*, Street+, City, State?,
                         PostalCode?, Country)>
<!ATTLIST PostalAddress
    name  %string;  #IMPLIED
>

<!--
    Address is the association of a Contact and an Location.

    isoCountryCode
        The ISO 3166 2-letter country code for the country containing this
        location.

    addressID
        An id for the address.  Needed to support address codes for
        relationships that require id references.  An example would be a
        shipping code.
-->
<!ELEMENT Address (Name, PostalAddress?, Email?, Phone?, Fax?, URL?)>
<!ATTLIST Address
    isoCountryCode  %isoCountryCode;  #IMPLIED
    addressID       %string;          #IMPLIED
>

<!-- Financial Elements -->
<!--
    Money is the representation of the object used to pay for items.

    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)> <!-- number -->
<!ATTLIST Money
    currency           %isoCurrencyCode;  #REQUIRED
    alternateAmount    %number;           #IMPLIED
    alternateCurrency  %isoCurrencyCode;  #IMPLIED
>

<!--
    Optional textual child for communicating arbitrary comments or
    description along with the parent.
    Though text may be interspersed with Attachment elements in this content
    model, grouping the Attachment list at the begging or end of the element
    is much preferred.  The intended content model would be more like
    (( Attachment+, #PCDATA ) | ( #PCDATA | Attachment* )) if the DTD syntax
    supported it.

    xml:lang
        The language in which the Comments are written.  This attribute
    will be required in a future version of cXML.  (Leaving it out is
    deprecated.)
-->
<!ELEMENT Comments ( #PCDATA | Attachment )* > <!-- mixed: string and
                                                    opt. Attachment list -->
<!ATTLIST Comments
    xml:lang  %xmlLangCode;  #IMPLIED
>

<!--
    Optional child of Comments element referencing a part in a multipart MIME
    transmission.

    The contained URL must use the scheme "cid:".  This is the identifier for
    the referenced attachment within the larger transmission.  Must match the
    Content-ID header of one (and only one) part of the MIME transmission
    containing this cXML document.  May also be used to retrieve the
    attachment file separately.
-->
<!ELEMENT Attachment (URL)>

<!---
    Reference to a remote attachment. 

    AttachmentReference is used inside Extrinsic elements that have a
    predefined name of "Attachments".

    In the context of AttachmentReference, the domain attribute of
    InternalID is currently optional. However, as a way to prevent
    circular request paths, the sending application may use a
    predefined value of "local" to indicate that the attachment
    requested is local to the other application.
	
    length
        length of the attachment in bytes.
-->
<!ELEMENT AttachmentReference (Name, Description, InternalID)>
<!ATTLIST AttachmentReference
    length  %uint;  #IMPLIED
>

<!--
    Price per unit of item.
-->
<!ELEMENT UnitPrice (Money)>

<!--
    Reference to an earlier document (for example, OrderRequest).  In a
    StatusUpdateRequest, this element identifies the purchase order to be
    updated.

    payloadID
        A unique identifier for the document.  Copied directly from the
        cXML element of the original document.
-->
<!ELEMENT DocumentReference EMPTY>
<!ATTLIST DocumentReference
    payloadID       %string;      #REQUIRED
>

<!ELEMENT InternalID (#PCDATA)> <!-- string -->
<!ATTLIST InternalID
    domain   %string;  #IMPLIED
>

<!-- ====
    Common to most variants of the PunchOut transaction set.  Defined here
    to be easily shared between multiple DTD files without requiring
    inclusion of Transaction.mod in all of them.

    All of the PunchOut transaction sets include an originating Request
    (ProviderSetupRequest for example), relatively simple Response
    (PunchOutSetupResponse for example) and final Message
    (ProviderDoneMessage or PunchOutOrderMessage).  The Request and
    Response comprise a back-end transaction between two cooperating
    applications that wish to extend an interactive session from one to the
    other.  The Request provides the destination application with
    authentication, identification and other setup information.  The
    Response provides the originating application with a unique starting
    location for the interactive (HTML) session at the destination system.

    After receiving a Response of this type, the originating application
    redirects the user's browser to the provided location.  (For some
    non-HTML applications, opening a new browser window at that location
    may be more appropriate.)  The destination system eventually provides
    an HTML form to the user's browser.  This form submits the final
    Message to close the remote session, return that user to the
    originating application and carry any required information back to the
    originating application.
==== -->

<!--
    OriginatorCookie - Identification of a specific PunchOut session.  Used
    in both originating Request and later Message that returns user to
    originating application.

    Note: The BuyerCookie element used in a 'regular' PunchOut transaction
    (defined in Transaction.mod) is of type ANY.  That does not seem
    useful.  The string required below better matches the needs for this
    element.  Future transactions similar to the PunchOut transaction will
    use this element.
-->
<!ELEMENT OriginatorCookie (#PCDATA)>

<!--
    BrowserFormPost - Location to which the user's browser must submit the
    final Message.  This location (carried in the originating Request) does
    not need to be specific to a PunchOut session since the
    OriginatorCookie is returned in the Message.
-->
<!ELEMENT BrowserFormPost (URL)>

<!--
    SelectedService - Identification of a service offered by this provider
    and requested in this transaction.  Used only in the originating
    Request.
-->
<!ELEMENT SelectedService (#PCDATA)>

<!--
    StartPage - Location to which the user's browser must be redirected to
    begin the interactive portion of the session at the remote site.  The
    destination system returns this information in the Response document.
    This location must be specific to a particular session.  It is
    effectively a one time key, providing authenticated entry into the
    destination system.
-->
<!ELEMENT StartPage (URL)>

<!--
    ReturnData - Any information the originator must know about the
    completed operation at the provider site.  The ReturnValue is for
    applications; the Name is for human consumption (direct presentation in
    the User Interface of the application).  Where appropriate for the
    possible services, this element may appear in the final Message for a
    PunchOut session.

    name
        An identifier for the data returned.  Provides a meaning for the
        contents of a ReturnData element.
-->
<!ELEMENT ReturnData (ReturnValue, Name)>
<!ATTLIST ReturnData
    name  %string;  #IMPLIED
>

<!ELEMENT ReturnValue (#PCDATA)>

<!--
    Defines a time range. The start and end can be unbounded
    startDate
        The starting date of the time range
    endDate
        The ending date of the range
-->
<!ELEMENT TimeRange EMPTY>
<!ATTLIST TimeRange
    startDate      %datetime.tz;         #IMPLIED
    endDate        %datetime.tz;         #IMPLIED
>

<!--
    Defines a period in time.

    startDate
        The starting date of the period

    endDate
        The ending date of the period
-->
<!ELEMENT Period EMPTY>
<!ATTLIST Period
    startDate      %datetime.tz;         #REQUIRED
    endDate        %datetime.tz;         #REQUIRED
>

<!--
    Must be a UN/CEFACT (Recommendation 20) unit of measure code.
-->
<!ELEMENT UnitOfMeasure (#PCDATA)> <!-- nmtoken -->

<!--
    Defines a reference to a term which is defined
    in another document.
    
    termName
        The name of the ID attribute containing the term.
        
    term
        The value of that attribute (i.e., the term itself).
            
-->
<!ELEMENT TermReference EMPTY>
<!ATTLIST TermReference
	termName %string; #REQUIRED
	term %string; #REQUIRED
>

<!--
    Defines an optionally named monetary rate at which goods or services are
    charged or paid. 

    Money
        The amount of Money per UnitOfMeasure to be charged or paid. 

    UnitOfMeasure
        Unit of measure.

    TermReference 
        Identifies the definition of this UnitRate 
        (found, for example,  in contracts, master agreements, and other documents
        which may or may not be cXML documents).
-->
<!ELEMENT UnitRate (
    Money,
    UnitOfMeasure,
    TermReference?
)>

<!--
    The rate information used to define the rate of a purchase.  For
    example, this could be the total room rate for 4 nights of stay
    at a hotel.

    Total
        The total amount for the rate.  The total amount must equal
        to quantity x UnitRate.

    UnitRate
        The single unit rate.

    Description
        Textual description for the rate.  For example, hotel nightly rate.

    Quantity
        The quantity.  For example, a 4 nights stay at a hotel will
        have quantity set to 4 with UnitofMesure in UnitRate set to Day.
-->
<!ELEMENT Rate (Total, UnitRate, Description?)>
<!ATTLIST Rate
    quantity    %r8;    #REQUIRED
>

<!--
    The total for something.
-->
<!ELEMENT Total (Money)>

<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/modules/Version.mod#4 $
-->

<!--
     Another top-level entity used in Transport.mod.  Defined here to allow
     easy updates to the release version of cXML without opening
     Transport.mod.  This should also provide an easy file to search for
     the current release version string.
-->

<!-- cxml.version
    Current default string for the cXML@version attribute.  Corresponds to
    the final directory of the SYSTEM identifier used in all up-to-date
    cXML documents.
    For easy parsing of this file, do not remove whitespace surrounding the
    actual version string.
-->
<!ENTITY cxml.version "1.2.021" >
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/schema/Modules/Supplier.mod#1 $
-->

<!--
    Supplier of goods and services. Includes a list of SupplierIDs which
    identify the Supplier.

    corporateURL
        URL to web site about the supplier

    storeFrontURL
        URL to web site where a user can shop or browse
-->
<!ELEMENT Supplier (Name, Comments?, SupplierID+, SupplierLocation*)>
<!ATTLIST Supplier
    corporateURL   %URL;  #IMPLIED
    storeFrontURL  %URL;  #IMPLIED
>

<!--
    One of the locations for a supplier. Supplier location is
    generally a physical location.
-->
<!ELEMENT SupplierLocation (Address, OrderMethods)>

<!--
    OrderMethods is the list of methods by which one can order
    from a supplier. The contact element is the technical contact
    who should be able to assist with order processing issues.
    The list is to be ordered by supplier preference, the first
    element having the highest degree of preference.
-->
<!ELEMENT OrderMethods (OrderMethod+, Contact?)>

<!--
    OrderMethod is a method for ordering. It is comprised of a
    target address for the order and the protocol expected by
    the address.
-->
<!ELEMENT OrderMethod (OrderTarget, OrderProtocol?)>

<!--
    OrderTarget represents an address to which orders can be
    sent.
-->
<!ELEMENT OrderTarget (Phone | Email | Fax | URL | OtherOrderTarget)>

<!--
    OrderProtocol is the communication method to be used when
    communicating an order to a supplier. An example would be "cXML".
-->
<!ELEMENT OrderProtocol (#PCDATA)> <!-- string -->

<!--
    OtherOrderTarget represents an address which is not enumerated by
    default in the OrderTarget Element. This may contain address targets
    beyond the ability of this document to describe.

    name
        Optional name for target.
-->
<!ELEMENT OtherOrderTarget ANY>
<!ATTLIST OtherOrderTarget
    name  %string;  #IMPLIED
>

<!--
    Definition of a supplier id.  A supplier id is a (domain, value)
    pair so that suppliers have the flexibility to define their id's
    according to an arbitrary convention (e.g., (DUNS, 12345),
    (TaxID, 88888888)).

    domain
        the domain of the id
-->

<!ELEMENT SupplierID (#PCDATA)> <!-- string -->
<!ATTLIST SupplierID
    domain  %string;  #REQUIRED
>
<!--
   Defines a List of Suppliers that might be associated with a quote Item. Used in
   ItemOut. 
-->
<!ELEMENT SupplierList (Supplier+)>
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/modules/Item.mod#6 $
-->

<!--
    ID with which the item's manufacturer identifies the item.
-->
<!ELEMENT ManufacturerPartID (#PCDATA)> <!-- string -->

<!--
    Name of the item's manufacturer.

    xml:lang
        The language in which the ManufacturerName is written.  This
    attribute will be required in a future version of cXML.  (Leaving it
    out is deprecated.)
-->
<!ELEMENT ManufacturerName (#PCDATA)> <!-- string -->
<!ATTLIST ManufacturerName
    xml:lang %xmlLangCode; #IMPLIED
>

<!--
    Classification is used to group items into similar categories.

    domain
        "name" of classification, ie., SPSC
-->
<!ELEMENT Classification (#PCDATA)> <!-- string -->
<!ATTLIST Classification
    domain  %string;  #REQUIRED
>

<!--
     LeadTime specifies, in days, the amount of time required to
     receive the item.
-->
<!ELEMENT LeadTime (#PCDATA)>   <!-- uint -->

<!--
    How the supplier identifies an item they sell.

    If SupplierPartID does not provide a unique key to identify the item,
    then the supplier should generate a key which identifies the part
    uniquely when combined with the SupplierID and SupplierPartID. The
    key is called SupplierPartAuxiliaryID.


    An example is where a Supplier would use the same PartID for an
    item but have a different price for units of "EA" versus "BOX".
    In this case, the ItemIDs should be:
    <ItemID>
        <SupplierPartID>pn12345</SupplierPartID>
        <SupplierPartAuxiliaryID>EA</SupplierPartAuxiliaryID>
    </ItemID>
    <ItemID>
        <SupplierPartID>pn12345</SupplierPartID>
        <SupplierPartAuxiliaryID>
           <foo>well formed XML here</foo>
        </SupplierPartAuxiliaryID>
    </ItemID>
    In this case, the "foo" element must be defined in an internal subset
    sent with the cXML document.  Otherwise, parsers will not be able to
    validate that document.

    In a preferred approach, the sending application may escape the contained
    XML using CDATA sections.  This would appear as:
       ...
       <SupplierPartAuxiliaryID>
           <![CDATA[<foo>well formed XML here</foo>]]>
       </SupplierPartAuxiliaryID>
       ...

    Finally, the angle brackets could be escaped using XML character
    entities.  This might be a bit harder for humans to read.  For example:
       ...
       <SupplierPartAuxiliaryID>
           &lt;foo&gt;well formed XML here&lt;/foo&gt;
       </SupplierPartAuxiliaryID>
       ...

     
-->
<!ELEMENT SupplierPartID (#PCDATA)> <!-- string -->

<!ELEMENT SupplierPartAuxiliaryID ANY>

<!--
    A unique identification of an item. SupplierID is not required since
    ItemIDs never travel alone.

    ItemIDs used to define a Supplier/Commodity level Blanket Order Item should
    use Empty SupplierPartID tag. These type of items do not have specific part numbers
    at the time of placing the Blanket Order. There will be subsequent release orders
    or invoices that will define the SupplierID.
-->
<!ELEMENT ItemID (SupplierPartID, SupplierPartAuxiliaryID?)>

<!--
    ItemDetail contains detailed information about an item. All the data that
    a user would want to see about an item instead of the bare essentials
    that are represented in the ItemID.

    LeadTime
        time in days to receive the item
-->
<!ELEMENT ItemDetail (UnitPrice, Description+, UnitOfMeasure,
                      Classification+, ManufacturerPartID?,
                      ManufacturerName?, URL?, LeadTime?, Extrinsic*)>


<!--
	Item details specific for items that describe blanket purchase order items. 
	This element should only be used for items in a purchase order of 
	type "blanket"	
-->
<!ELEMENT BlanketItemDetail (Description+, MaxAmount?, MinAmount?, 
                             MaxQuantity?, MinQuantity?,
			     UnitPrice?, UnitOfMeasure?,
			     Classification*, Extrinsic*)>
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id$
-->

<!--
    This element captures travel information.  It could be one of four
    types: air, car rental, hotel or rail.

    AirDetail
        Air travel detail.

    CarRentalDetail
        Car rental detail.

    HotelDetail
        Hotel detail.

    RailDetail
        Rail detail.

    PolicyViolation
        List of policy violations (if any) associated with this
        travel line item.

    Comments
        Top level comments for this travel line item (if any).  This
        is not the policy violation comment but a top level comment
        given by the user for this travel line item while in Travel
        Booking Provider's web site.

    TermsAndConditions
        List of Terms and conditions (if any) associated with this
        travel line item.

    confirmationNumber
        A unique confirmation number that is useful to both the
        traveler and the vendor who is providing the service for this
        travel line item.  For example, hotel reservation number or
        e-ticket number from the airline.

    pnrLocator
        Passenger Name Record (PNR) Locator that is useful to the
        Travel Booking Provider.

    quoteExpirationTime
        Date and time that this quote will expire.  This value is
        normally supplied in the PunchoutOrderMessage.  If no value is
        supplied, it is assumed that there is no expiration time or
        date for this quote.
-->
<!ELEMENT  TravelDetail ((AirDetail | CarRentalDetail | HotelDetail | RailDetail),
                          PolicyViolation*,
                          Comments?,
                          TermsAndConditions?)>
<!ATTLIST TravelDetail
    confirmationNumber  %string;        #REQUIRED
    pnrLocator          %string;        #IMPLIED
    quoteExpirationTime %datetime.tz;   #IMPLIED
>

<!-- Air -->

<!--
    Air detail information for the air trip.

    TripType
        Round Trip, One Way, or Multi Leg

    AirLeg
        Different air leg that makes up this air detail.
        For example a round trip from SFO -> TPE with no stops
        will have two air legs.  One air leg from SFO -> TPE
        and another from TPE -> SFO.

    AvailablePrice
        Other available airfare prices that the user did not pick.

    Penalty
        Penalty amount (if any).  This is normally due to changes or
        cancelation of the ticket.
-->
<!ELEMENT AirDetail (TripType,
                     AirLeg+,
                     AvailablePrice*,
                     Penalty?)>

<!--
    Define a single leg in the air travel.

    Vendor
        Airline vendor name and information.

    AirLegOrigin
        Originating airport for this air leg.

    AirLegDestination
        Destination airport for this air leg.

    BookingClassCode
        Airline booking class code.  This is the de-facto
        airline standard.  For example,

        F, FN, P, R, A      - first class
        C, CN, D, J, I, Z   - business class.
        Y, YN, B, BN, M, H, V, VN, O, Q, QN, S, 
            K, KN, L, U, T, W - coach class.

    Rate
        Rate for this particular air leg.  If specify, the total
        of all the rate for the different air legs must add up
        to the total the line item level.

    Meal
        Meal information for this air leg (if any)

    travelSegment
        Textual information to identify this travel segment.
        This information is specific to the Travel Booking Provider.

    departureTime
        Departure date and time for this air leg

    arrivalTime
        Arrival date and time for this air leg

    flightNumber
        Flight number for this air leg

    seatNumber
        Seat number for this air leg

    seatType
	    Seat type
	        aisle       - Aisle
	        window      - Window
	        middle      - Middle

    upgrade
        Is this ticket an upgrade?

    stops
        The number of stop for this air leg.
        0 if it is a direct flight.  If no information is supplied
        it is defaulted to 0.

    equipment
        The plane equipment information for this air leg
-->
<!ELEMENT AirLeg (Vendor,
                  AirLegOrigin,
                  AirLegDestination,
                  BookingClassCode?,
                  Rate?,
                  Meal*)>
<!ATTLIST AirLeg
    travelSegment   %string;        #REQUIRED
    departureTime   %datetime.tz;   #REQUIRED
    arrivalTime     %datetime.tz;   #REQUIRED
    flightNumber    %string;        #REQUIRED
    seatNumber      %string;        #IMPLIED
    seatType        (window | aisle | middle) #IMPLIED
    upgrade         (yes)           #IMPLIED
    stops           %r8;            #IMPLIED
    equipment       %string;        #IMPLIED
>

<!--
    Originating airport for this Air Leg.

    Airport
        Originating airport
-->
<!ELEMENT AirLegOrigin (Airport)>

<!--
    Destination airport for this Air Leg.

    Airport
        Destination airport
-->
<!ELEMENT AirLegDestination (Airport)>

<!--
    Airport information that includes the iso airport code

    Address
        Physical adress of the airport.

    airportCode
        The 3 letter IATA airport code.
-->
<!ELEMENT Airport (Address?)>
<!ATTLIST Airport airportCode %string; #REQUIRED>

<!---
    Meal information used by air, hotel and rail.

    BookingClassCode
        Code for the meal.  For example, airlines use
		B     - Breakfast
            C     - Complimentary liquor
            D     - Dinner
            F     - Food for purchase
            G     - Food and beverage for purchase
            H     - Hot meal
            K     - Continental breakfast
            L     - Lunch
            M     - Meal
            N     - No meal service 
            O     - Cold meal
            P     - Liquor for purchase
            R     - Refreshments
            S     - Snack or brunch
            V     - Refreshments for purchase

    Description
        Textual description of the meal, including any special needs
        such as vegetarian or dairy-free.
-->
<!ELEMENT Meal (BookingClassCode?, Description?)>

<!-- Car Rental -->

<!--
    Car rental information.

    Vendor
        Car rental vendor information.

    CarRentalPickup
        Pickup location for the rental car.

    CarRentalDropoff
        Drop off location for the rental car.

    BookingClassCode
        4 letter code for car.

        1st Letter - M (Mini), E (Economy), C (Compact), S (Standard),
                     I (Intermediate), F (Full size), P (Premium), L (Luxury)
                     V (MiniVan), X (Special)
        2nd Letter - B (2 door), C (2/4 door), D (4 door), T (Convertible),
                     F (Four wheel drive), V (Van), W (Wagon), S (Sport)
                     X (Special)
        3rd Letter - A (Automatic), M (Manual)
        4th Letter - R (A/c), N (No A/C)

    CarRentalFee
        Mutliple car rental fee can be specified to capture the
        break down of different fees.  The total of these fees must
        add up to the total at the line item level.

    LimitedMileage
        Mileage limit information

    AvailablePrice
        Other available prices for car rental that the user did not pick.

    travelSegment
        Textual information to identify this travel segment.
        This information is specific to the Travel Booking Provider.

    pickupTime
        The intended pickup date and time

    dropoffTime
        The intended dropoff date and time
-->
<!ELEMENT CarRentalDetail (Vendor,
                           CarRentalPickup,
                           CarRentalDropoff,
                           BookingClassCode?,
                           CarRentalFee+,
                           LimitedMileage?,
                           AvailablePrice*)>
<!ATTLIST CarRentalDetail
    travelSegment %string;          #REQUIRED
    pickupTime    %datetime.tz; 	#REQUIRED
    dropoffTime   %datetime.tz; 	#REQUIRED
>

<!--
    Physical location where the rental car should be picked up.  This
    is either an Airport or off airport car rental location.

    Airport
        An airport location.

    Address
        Physical address of the car rental location
-->
<!ELEMENT CarRentalPickup (Airport | Address)>

<!--
    Physical location where the rental car should be dropped off.
    This is either an Airport or off-airport car rental location.

    Airport
        An airport location.

    Address
        Physical address of the car rental location
-->
<!ELEMENT CarRentalDropoff (Airport | Address)>

<!--
    This specifies the quantity and the unit of measure of the mileage
    limit.

    UnitOfMeasure
        Unit of measure either miles or kilometers.

    quantity
        The mileage limit amount.
-->
<!ELEMENT LimitedMileage (UnitOfMeasure)>
<!ATTLIST LimitedMileage
    quantity   %r8;      #REQUIRED
>

<!--
    Car rental fee information.  CarRentalFee captures the actual
    charges and fee that applies to this rental.  Conditional charges
    such as extra mileages that are over the mileage limit should not
    be specified here but rather in the TermsAndConditions text.

    Total
        Total amount for this car rental fee.  All the total for the rates
        must add up to this amount.

    Rate
        The individual broken-down fee information.

    type
        Type of rate
            baseRate            - Base rental rate
            additionalDriver    - Additional driver fee
            airportAccessFee    - Airport Access fee
            dropOffCharge       - Drop off charge
            vehicleLicensingFee - Vehicle lincensing fee
            touristTax          - Tourist tax
            prepaidGasoline     - Prepaid gasoline charge
            navigationSystem    - Navigation system
            childSeat           - Child seat charge
            luggageRack         - Luggage rack charge
            collisionDamageInsurance    - Collision damage insurance
            liabilityInsurance          - Liability insurance
            mobilePhone         - Mobile phone base charge
            other               - Other charges.
-->
<!ELEMENT CarRentalFee (Total, Rate*)>
<!ATTLIST CarRentalFee
    type (baseRate | additionalDriver | airportAccessFee | dropOffCharge |
          vehicleLicensingFee | touristTax | prepaidGasoline |
          navigationSystem | childSeat | luggageRack | collisionDamageInsurance |
          liabilityInsurance | mobilePhone | other) "baseRate"
>

<!-- Hotel -->

<!--
    Hotel detail information.

    Vendor
        Hotel vendor information.

    Address
        Physical address of the hotel.  This is might be different
        from the address specified in the Vendor field as the vendor
        address might be the head quarter address.

    RoomType
        The type of room reserved.

    BookingClassCode
        Hotel booking class code.

    Meal
        Any complementary meals that are included with the room.  For
        example, complementary continental breakfast.

    Rate
        Hotel rate information.  Multiple rates can be specified.  For
        example, the night rate, valet parking rate, and other rates.

    AvailablePrice
        Other available prices that user did not pick.  Available
        prices can be from the same vendor or different vendor.

    travelSegment
        Textual information to identify this travel segment.  This
        information is specific to the Travel Booking Provider.

    arrivalTime
        Date and time of arrival at the hotel.  This is used as an
        advisory to the hotel vendor for the arrival time.

    departureTime
        Date and time of departure from the hotel.  This is used as an
        advisory to the hotel vendor for the departure time.

    checkinTime
        The official checkin time.  For example, most hotel checkin
        time is 3:00 PM.

    checkoutTime
        The official checkout time.  For example, most hotel checkout
        time is 12:00 PM (noon).

    earlyCheckinAllowed
        Does the hotel allow early checkin?

    lateCheckoutAllowed
        Does the hotel allow late checkout?
-->
<!ELEMENT HotelDetail (Vendor,
                       Address,
                       RoomType,
                       BookingClassCode?,
                       Meal*,
                       Rate*,
                       AvailablePrice*)>
<!ATTLIST HotelDetail
    travelSegment   %string;         #REQUIRED
    arrivalTime     %datetime.tz;    #REQUIRED
    departureTime   %datetime.tz;    #REQUIRED
    checkinTime     %time.tz;        #REQUIRED
    checkoutTime    %time.tz;        #REQUIRED
    earlyCheckinAllowed (yes)        #IMPLIED
    lateCheckoutAllowed (yes)        #IMPLIED
>

<!--
    Information about a hotel room.

    Description
        Textual description of the hotel room.

    Amenities
        List of amenities for this hotel room.

    smoking
        Is the room a smoking or non-smoking room

    numberOfBed
        The number of beds in this room

    bedType
        The bed type in this room.
-->
<!ELEMENT RoomType (Description?, Amenities*)>
<!ATTLIST RoomType
    smoking        (yes | no)   #REQUIRED
    numberOfBed    %r8;         #IMPLIED
    bedType        (king | queen | full | double | single | other)    #IMPLIED
>

<!--
    Textual description of the amenities for the hotel room.

    Description
        Text description of this amenities.  For example,
        DSL connection, two telephone lines, and other information
        about a hotel room.
-->
<!ELEMENT Amenities (Description)>

<!-- Rail -->

<!--
    Rail detail information.  A rail detail can have multiple legs.

    TripType
        Trip type for this rail.

    Rail leg
        The different rail legs that make up this rail detail.

    AvailablePrice
        Other available prices that the user did not pick for for this
        rail trip.

    Penalty
        Penalty (if any) associated with this rail trip.
-->
<!ELEMENT RailDetail (TripType,
                      RailLeg+,
                      AvailablePrice*,
                      Penalty?)>

<!--
    Rail leg is used to express information regarding a single leg for
    a rail travel.

    Vendor
        Rail vendor information.

    RailLegOrigin
        Rail originating location.

    RailLegDestination
        Rail Destination location.

    BookingClassCode
        Rail booking class code.

    Rate
        Rate information (if any) for this rail leg.  If specified,
        all the rates in all rail legs must add up to the total at the
        travel line item level.

    Meal
        Meal served for this leg (if any).

    travelSegment
        Textual information to identify this travel segment.  This
        information is specific to the Travel Booking Provider.

    departureTime
        Date and time of departure at the originating location.

    arrivalTime
         Date and time of arrival at the destination location.

    trainNumber
        Train number for this rail leg.

    seatNumber
        Seat number.

    carType
        Type of the rail car.
-->
<!ELEMENT RailLeg (Vendor,
                   RailLegOrigin,
                   RailLegDestination,
                   BookingClassCode?,
                   Rate?,
                   Meal*)>
<!ATTLIST RailLeg
    travelSegment   %string;        #REQUIRED
    departureTime   %datetime.tz;   #REQUIRED
    arrivalTime     %datetime.tz;   #REQUIRED
    trainNumber     %string;        #REQUIRED
    seatNumber      %string;        #IMPLIED
    carType        (sleeper | seat) #IMPLIED
>

<!--
    The origin of a particular rail leg.  This can be an airport or a
    physical address of a rail station.

    Airport
        An airport location

    Address
        A physical address of a rail station
-->
<!ELEMENT RailLegOrigin (Airport | Address)>

<!--
    The destination of a particular rail leg.  This can be an airport
    or a physical address of a rail station.

    Airport
        An airport location

    Address
        A physical address of a rail station
-->
<!ELEMENT RailLegDestination (Airport | Address)>

<!-- Travel/Expense common definitions -->

<!--
    The type of the trip. This is used by Air and Rail to indicate
    round trip, one way or multi-leg trip.

    type
        Type of the trip
	    round       - a round trip
	    oneWay      - a one way trip
	    multiLeg    - a multi leg or open jaw trip
-->
<!ELEMENT TripType EMPTY>
<!ATTLIST TripType
    type    (round | oneWay | multiLeg) #REQUIRED
>

<!--
    Information about a vendor that is providing this service.

    Address
        The physical address of the vendor.  This address normally is
        the business or head quarter address of the vendor.

    SupplierID
        Supplier id for this vendor.  This is just a (domain, value)
        pair so that Travel Booking Providers have the flexibility to
        define their id's according to an arbitrary convention (e.g.,
        (DUNS, 12345), (TaxID, 88888888)).

        Note that multiple supplier id can be specified.  This is so
        that Travel Booking Provider can have a single implementation
        that works with different Buyer implementations that use
        different supplier id domain.

    preferred
        Is this vendor a preferred vendor?
-->
<!ELEMENT Vendor (Address, SupplierID*)>
<!ATTLIST Vendor
    preferred (yes | no) #REQUIRED
>

<!--
    Textual terms and conditions associated with an air fare, car
    rental, hotel, or rail.  For example, a car rental terms and
    conditions normally include boundary limit, additional mileage
    charges, gasoline charge and other restriction information.

    Multiple terms and conditions can be attached to a single travel
    line item.

    Description
        Textual terms and conditions.
-->
<!ELEMENT TermsAndConditions (Description+)>

<!--
    Policy violation (if any) that results from the user picking this
    particular travel.  Policy violations are associated with an
    individual line item of travel and not associated at the header
    level.  This allows for clear identification of the violation with
    the individual line item.

    Description
        Textual description of this violation.

    PolicyViolationJustification
        Justification for this violation given by user normally picked
	from a standard list of justifications at the Travel Booking
	Provider web site.

    Comments
        Additional comments to further clarify the justification given
        by user.

    level
        Violation level.
            warning     - a non serious violation.
            violation   - a serious violation of company policy.
-->
<!ELEMENT PolicyViolation (Description,
                           PolicyViolationJustification,
                           Comments?)>
<!ATTLIST PolicyViolation
	level (warning | violation) #REQUIRED
>

<!--
    Justification given by the user why they violate the company
    travel policy.  This justification value is normally picked from a
    pick list at the Travel Booking Provider web site.

    Description
        The justification of the violation picked from a standard list
        at the Travel Booking Provider web site.
-->
<!ELEMENT PolicyViolationJustification (Description)>

<!--
    Penalty (if any) for this travel segment

    Money
        The penalty amount

    Description
        Textual description of the cause of the penalty.  For example,
        change fee associated with air ticket.
-->
<!ELEMENT Penalty (Money, Description)>

<!--
    Other avaible price.  AvailablePrice is used to express what other
    prices are available that the traveler did not pick.
    AvailablePrice is can be used to capture the lowest price, the
    highest price, the lowest compliant price, and the hight compliant
    price.

    Money
        The amount of the other available price.

    Description
        Textual description of the available price.  It explain
        how this price was derived at.  For example, a non direct flight
        exists with the flight number can be put here.

    Type
        Type of available price.  Currently we capture four
        different type.
            lowest              - The lowest price possible regardless of the
                                  traveling policies
            lowestCompliant     - The lowest price that still complies with
                                  the travel policies
            highestCompliant    - The highest price that still complies with
                                  the travel policies
            highest             - The highest price possible regardless of the travel
                                  policies
            other               - Other, specify in the description
-->
<!ELEMENT AvailablePrice (Money, Description?)>
<!ATTLIST AvailablePrice
    type (lowest | lowestCompliant | highestCompliant | highest | other) #REQUIRED
>

<!--
    Booking class code used by airfare, car rental, hotel, and rail to
    indicate the class.

    Description
        Textual description of the code

    code
        code
-->
<!ELEMENT BookingClassCode (Description?)>
<!ATTLIST BookingClassCode
    domain  %string;    #REQUIRED
    code    %string;    #REQUIRED
>

<!--
    Define a physical location and its address.  This can be used to 
    describe places such as airport, bus station, ferry dock, railway
    station and so on.

    Address
        Indicates the address of the place

    code
        Indicates the code the may represent the place.  For example,
        airport can have an airport code.

    domain
        Qualifier or domain for the code.  For example, airport code
        is IATA standard, the domain value would be "IATA"; however
        bus station code may be local specific.
-->
<!ELEMENT Place (Address?)>
<!ATTLIST Place
    code           %string;     #IMPLIED
    domain         %string;     #IMPLIED
>

<!--
    Defines places such as city, airport or railway where trip or leg originated.
-->
<!ELEMENT LegOrigin (Place)>

<!--
    Defines places such as city, airport or railway code where trip or leg ended.
-->
<!ELEMENT LegDestination (Place)>
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/schema/Modules/Transaction.mod#27 $
-->

<!--
    For better definitions of these Elements/Entities, refer to the cXML
    Transaction Specification documents.
-->
<!-- 
     Detailed per-unit asset information for a line item.

     Extrinsic
         Additional per-unit asset information

     serialNumber
         Manufacturer's serial number for the unit

     tagNumber
         Asset tag number for the unit

     location
         location of the unit
-->
<!ELEMENT AssetInfo (Extrinsic*)>
<!ATTLIST AssetInfo
	tagNumber %string; #IMPLIED
	serialNumber %string; #IMPLIED
	location %string; #IMPLIED
>

<!-- Basic transactional elements used throughout -->

<!--
    Defines gross amount in posted currency.
-->
<!ELEMENT TotalAmountInPostedCurrency (Money)>

<!--
    Defines gross amount in billing currency. If specified, customer
    needs to pay this amount.
-->
<!ELEMENT TotalAmountInBillingCurrency (Money)>

<!--
    The bill to for an item.
-->
<!ELEMENT BillTo (Address)>

<!--
    The ship to for a item.
-->
<!ELEMENT ShipTo (Address)>

<!--
    Definition of a cXML Shipping item. Represents a shipping cost in the
    shopping basket (PunchOutOrderMessage) or an order to the supplier
    (OrderRequest). There could be one of these for the entire order, or one
    per lineitem.

    trackingDomain
        represents the logistics supplier, I.E., "FedEx", "UPS", etc.

    trackingId
        an optional element value that represents the logistics supplier
        tracking number

    tracking
        Deprecated - Do Not Use
-->
<!ELEMENT Shipping (Money, Description)>
<!ATTLIST Shipping
    trackingDomain  %string;  #IMPLIED
    trackingId      %string;  #IMPLIED
    tracking        %string;  #IMPLIED
>

<!--
    Defines discount applied.

    DiscountAmount
        	The discount expressed as a flat amount with currency.

    DiscountPercent
        	The discount rate expressed as a percentage.
-->
<!ELEMENT Discount (DiscountPercent | DiscountAmount)>

<!--
    Defines the discount rate

    percent
        The discount rate expressed as a percentage.  A negative discount percent
        represents a penalty.
-->
<!ELEMENT DiscountPercent EMPTY>
<!ATTLIST DiscountPercent
	percent          %r8;           #REQUIRED
>

<!--
    Defines a payment term in an invoice or order.  This deprecates the
		InvoiceDetailPaymentTerm previously defined.  Payment term can be the 
		net term (without discount) or discount term (with discount).

    payInNumberOfDays
        The number of days after invoice effective date for the invoice to be paid.

    Discount
	 	The percentage or amount of the discount term.  This element should be omitted
	 	if the payment term is a net term.
-->
<!ELEMENT PaymentTerm (Discount?)>
<!ATTLIST PaymentTerm
    payInNumberOfDays        %uint;         #REQUIRED
>

<!--
    The list of valid payment types.
-->
<!ENTITY % cxml.payment  "PCard">
<!ELEMENT Payment (%cxml.payment;)>

<!--
    Defines an accounting segment.  Segment is an older, deprecated way to
    transport this information.

    type
        The accounting type of this segment.

    id
        The unique key of this Segment against the type.

    description
        Textual description of the Segment. For human readability.
-->
<!ELEMENT Segment EMPTY>
<!ATTLIST Segment
    type         %string;  #REQUIRED
    id           %string;  #REQUIRED
    description  %string;  #REQUIRED
>

<!--
    Defines an accounting segment.  AccountingSegment is the newer, better
    way to transport this information.  Name corresponds to the type
    attribute of Segment; Description corresponds to description.  Both add
    required locale attributes to the strings.

    id
        The unique key of this Segment against the type.
-->
<!ELEMENT AccountingSegment ( Name, Description )>
<!ATTLIST AccountingSegment
    id           %string;  #REQUIRED
>

<!--
    An accounting object.  Use of the Segment element here is deprecated.

    name
        The name of the object containing the specified accounting segments.
-->
<!ENTITY % cxml.accounting  "( Segment+ | AccountingSegment+ )">
<!ELEMENT Accounting (%cxml.accounting;)>
<!ATTLIST Accounting
    name  %string;  #REQUIRED
>

<!--
    A charge against an Accounting element.
-->
<!ELEMENT Charge (Money)>

<!--
    The combination of a Charge against an Accounting Element. A distribution
    represents the breakdown of one overall amount into sub-amounts.
-->
<!ELEMENT Distribution (Accounting, Charge)>

<!ELEMENT TaxAmount (Money)>

<!ELEMENT TaxableAmount (Money)>

<!--
    One language-specific string for the location of tax,
    e.g. London, Canada, California, etc.

    xml:lang
        The language or locale in which the location of tax is written.
-->
<!ELEMENT TaxLocation (#PCDATA)>              <!-- string -->
<!ATTLIST TaxLocation
   xml:lang              %xmlLangCode;         #REQUIRED
>

<!--

    TriangularTransactionLawReference indicates the relevant law as
    titled for the local jurisdiction in the scenario of a triangular
    transaction.  ex: Triangulation, article 28c,E paragraph 3 of the
    6th EU VAT Directive

    xml:lang
        the language in which the law reference is written.
-->
<!ELEMENT TriangularTransactionLawReference (#PCDATA)>
<!ATTLIST TriangularTransactionLawReference
    xml:lang   %xmlLangCode;    #REQUIRED
>

<!--
    Defines details of one type of tax.

    TaxableAmount
       The taxable amount.

    TaxAmount
       The tax amount.

    TaxLocation
       The tax location.

    Description
       The textual description of the current type of tax.

    TriangularTransactionLawReference
       The law reference for transactions where isTriangularTransaction is True

    purpose
       The purpose of the tax, e.g., tax (tax), custom duty, shippingTax, 
       specialHandlingTax, etc.

    category
       The tax category, Sales tax (sales), Use tax (usage), VAT (vat),
       GST (gst) are defined categories. Other values are permitted.

    percentageRate
       The tax rate in number of percentage.

    isVatRecoverable
       True if the VAT is recoverable.  Default is false.

    taxPointDate
       refers to the date on which VAT becomes due.

    paymentDate
       indicate the date when payment must be made.

    isTriangularTransaction
       True if the transaction is triangular.  Default is false.

    exemptDetail
       If the TaxAmount is zero, VAT or other regulations may require
       a reason why.  zeroRated means the tax rate is zero.  exempt
       means the item or items are exempt from taxation.

-->
<!ELEMENT TaxDetail (TaxableAmount?, TaxAmount, TaxLocation?, Description?,
                     TriangularTransactionLawReference?, Extrinsic*)>
<!ATTLIST TaxDetail
    purpose                 %string;       #IMPLIED
    category                %string;       #REQUIRED
    percentageRate          %r8;           #IMPLIED
    isVatRecoverable        (yes)          #IMPLIED
    taxPointDate            %datetime.tz;  #IMPLIED
    paymentDate             %datetime.tz;  #IMPLIED
    isTriangularTransaction (yes)          #IMPLIED
    exemptDetail            (zeroRated | exempt)  #IMPLIED
>

<!--
    Definition of a cXML Tax item. This represents what a Tax element should
    be in the classic notion of a line on a PO or Invoice. It can also
    represent a per-lineitem tax element depending on where it appears
    (inside of a item ELEMENT or inside of a something like a supplierOrder
    ELEMENT).

    Represents a tax item in the shopping basket. There could be one of these
    for the entire order, or one per lineitem.

    The total amount of taxes for the line item or order should be reflected
    in the Money element. The breakdown of taxes, for example, tax on shipping
    or tax on goods should be represented in separate TaxDetail elements.
-->
<!ELEMENT Tax (Money, Description, TaxDetail*, Extrinsic*)>

<!-- Item Elements -->
<!--
    The representation of a line item as it needs to be for sending to a
    supplier.

    quantity
        How many items are desired. Supplier and Commodity level items in an order of type
	"blanket" will use a default value of "1". The quantity in this case will not be
	used to compute the sub total. The MaxAmount in the BlanketItemDetail will be 
	used to indicate any line level amounts.
    lineNumber
        Position (counting from 1) of this item in an order.  Used to
        maintain a reference between items in create and update OrderRequest
        documents.
    requisitionID
        The buyers system requisition id for this line item. It might be the
        same as orderID, and it might not be included at all.  Must not be
        included if requisitionID is specified in the OrderRequestHeader.
    requestedDeliveryDate
        The date this item was requested for delivery.
    agreementItemNumber 
        The corresponding Item Number of the Item in the Master Agreement if this is 
	a 'release' order item.
-->
<!ELEMENT ItemOut (ItemID, Path?, (ItemDetail|BlanketItemDetail)?, (SupplierID | SupplierList)?, ShipTo?, Shipping?,
                   Tax?, SpendDetail?, Distribution*, Contact*, Comments?)>
<!ATTLIST ItemOut
    quantity               %r8;      #REQUIRED
    lineNumber             %uint;    #IMPLIED
    requisitionID          %string;  #IMPLIED
    agreementItemNumber	   %string;  #IMPLIED
    requestedDeliveryDate  %date;    #IMPLIED
    isAdHoc                (yes)     #IMPLIED
>

<!--
    The representation of a line item as it needs to be for sending to a
    buyer.

    quantity
        How many items are desired.
    lineNumber
        Position (counting from 1) of this item in an order.  Used to
        maintain a reference between items in create and update OrderRequest
        documents.
-->
<!ELEMENT ItemIn (ItemID, Path?, ItemDetail, SupplierID?, ShipTo?, Shipping?, Tax?, SpendDetail?)>
<!ATTLIST ItemIn
    quantity   %r8;      #REQUIRED
    lineNumber %uint;    #IMPLIED
>

<!--
    StatusUpdate for Confirmation (type=RequestToPay) request.

    transactionTimestamp
        time when the XMLPay transaction was submitted

    transactionID
        an identifier assisgned to the transaction by the payment processing gateway

    authorizationID
        the authorization code for the transaction provided by the bank

    isFailed
        should have a status code greater than zero.  Zero implies a successful transaction.
-->
<!ELEMENT PaymentStatus (PCard, Total, Shipping?, Tax?, Extrinsic*)>
<!ATTLIST PaymentStatus
    orderID    %string;    #REQUIRED
    transactionTimestamp    %datetime.tz;    #REQUIRED
    type    (Authorization| Settlement| Sale| Credit)    #REQUIRED
    isFailed   (yes)    #IMPLIED
    transactionID    %string;    #IMPLIED
    authorizationID    %string;    #IMPLIED
>

<!--
	Partial amount paid against an InvoiceDetail request. Used in InvoiceStatus.
	If this element exists in an InvoiceStatus element, it should mean that the buyer
	does not pay the full amount as the InvoiceDetail request specified. 
-->
<!ELEMENT PartialAmount (Money)>

<!--
	StatusUpdate for InvoiceDetail request.

        InvoiceIDInfo
        	ID of an invoice known to the supplier system. This attribute is used to reference an invoice in StatusUpdateRequest when DocumentReference is omitted.

	PartialAmount
		The partial amount paid against the InvoiceDetail document.  This attribute is
		only relevant when the status type is "paid".

	Comments
		Comments associated with the status update.

	type
		Type of the invoice status. 
                    processing - The invoice is received and being processed.
                    canceled - The invoice has been canceled.
                    reconciled - The invoice is reconciled. 
                    rejected - The invoice is rejected.
                    paying - The invoice is being paid. 
                    paid - The InvoiceDetail request is paid.  
-->

<!ELEMENT InvoiceStatus (InvoiceIDInfo?, PartialAmount?, Comments*)>
<!ATTLIST InvoiceStatus
	type	(processing | canceled | reconciled | rejected | paying | paid) #REQUIRED
>
	
<!-- OrderRequest* Elements -->
<!--
    Definition of an order.  This is the data that is sent to the supplier
    to have them place an order in their order management system. The new
    world order equivalent of a PO.
-->
<!ELEMENT OrderRequest (OrderRequestHeader, ItemOut+)>

<!--
    Header of an order.  This is the data that is sent to the supplier
    to have them place an order in their order management system. Money
    represents the total amount of this order.

    orderID
        The buyer system orderID for this request.  This is an internal
        Buyer unique number.

    orderVersion
        The buyer system order version number for this request. Relevant when
        the OrderRequest represents a change order request. The version number
        for the original document should be 1 and should be incremented by 1 for
        each subsequent version (2,3,4...).

    isInternalVersion
        A value of yes indicates that this OrderRequest is a version whose changes from
        the previous version are deemed internal to the buyer system. Relevant when the
        version being sent to the supplier is not the first version.

    orderDate
        The date and time the order request was created.

    type
        The type of the order request. Defaults to "new".

    requisitionID
        The buyers system requisition id for this entire order. It might be
        the same as orderID, and it might not be included at all.  Must not
        be included if requisitionID is specified in any ItemOut elements.

    shipComplete
        Optional preference for "hold until complete" processing.  Defaults
        to shipping when available if not specified.  Future versions of the
        protocol may extend the datatype of this attribute to include
        additional possible values (such as "unlessGreatlyBackOrdered"?).
    orderType
        "release", indicates that this is a Release Order from an existing
	Master Agreement/ Contract. Default is regular. Type "blanket" indicates
	that this order is a Blanket Order.
    releaseRequired
	"yes" if the blanket order allows released. Currently used only if 
	orderType is "blanket".
    effectiveDate
	Date the order is available for ordering. If orderType is "blanket", 
	effectiveDate is required. Otherwise it is optional. Currently only
	used with blanket orders.
    expirationDate
	Date the order is no longer available. If not defined, end date is open
	ended. Currently only used with blanket orders.
    agreementID
        Identifies associated agreement corresponding to the Release Order.
	At an implementation level it has to be validated that if the orderType
	is 'release' then the appropriate agreementID is also provided.
    agreementPayloadID
        Optional PayloadID for the corresponding Master Agreement.

    parentAgreementID
	Used only in the context of a Order of type "blanket". This identifies the
	parent blanket order if the current order is part of an hierarchy.

    parentAgreementPayloadID
        Optional PayloadID for the corresponding Master Agreement.

    Total 
	If the Order is of type "blanket", the Total element is not used to compute
	the sum of the item level subtotals. The total is used to indicate the maximum
	commitment with the supplier. The total will not add upto the individual item
	level sub total or MaxAmounts. The item level MaxAmounts should not exceed the
	header level total. If the item level MaxAmount is not specified it is assumed
	that the Item level maximum amount is the same as the Total.

    The contained DocumentReference element would appear in a document only
    when the type is "update" or "delete".  In that case, the
    DocumentReference would reference the most recent OrderRequest document
    for the order.  For example when an order is created, updated and then
    deleted, the final document should contain a DocumentReference
    referring to the OrderRequest with type="update".  That document would,
    in turn, refer to the original (type="new") OrderRequest document.
-->
<!ELEMENT OrderRequestHeader (Total, ShipTo?, BillTo, Shipping?, Tax?,
                              Payment?, PaymentTerm*, Contact*, Comments?, Followup?,
                              DocumentReference?, SupplierOrderInfo?, Extrinsic*)>
<!ATTLIST OrderRequestHeader
    orderID    %string;        #REQUIRED
    orderDate  %datetime.tz;   #REQUIRED
    orderType  (release| regular | blanket) "regular"
    releaseRequired (yes) #IMPLIED
    type       (new | update | delete)  "new"
    orderVersion %number;      #IMPLIED
    isInternalVersion  (yes)   #IMPLIED
    parentAgreementID %string;       #IMPLIED
    parentAgreementPayloadID %string; #IMPLIED
    effectiveDate  %datetime.tz;     #IMPLIED
    expirationDate %datetime.tz;    #IMPLIED
    agreementID %string;       #IMPLIED
    agreementPayloadID %string; #IMPLIED
    requisitionID   %string;   #IMPLIED
    shipComplete    (yes)      #IMPLIED
>
<!--
    Definition of a Master Agreement.  This is the electronic document representing the 
    Master Agreement that was created and agreed upon in the Buying organizations.
-->
<!ELEMENT MasterAgreementRequest (MasterAgreementRequestHeader, AgreementItemOut*)>

<!--
   Header of an Agreement.  This is the header level information in the Agreement.
   agreementID
	 The buyer system agreementID for this request.  the Master Agreement Number in Buyer.
   agreementDate
	 The date and time the agreement request was created. 
	 This is different from the effective and expiry date of the agreement.
   agreementType
	 Identifies if this is a Value based agreement or quantity based Agreement.
   requestType
	 The type of the agreement request. Defaults to "new".
   effectiveDate
         Date the Master Agreement is available for ordering/releases.
   expirationDate
         Date the Master Agreement is no longer available.
   parentAgreementPayloadID
	 PayloadID for the corresponding parent document that this agreement is derived from.
   operation: 
	"delete" operation will be used to cancel an existing Master Agreement, the
	 assumption here is that the delete request will be an exact replica of the 
	 original request.
	 "new" operation identifies a new MasterAgreement transaction.
	 "update" operation identified an update to an existing transaction. 
	 the DocumentReference attribute should be used to indicate the Orignal
	 Document information.
   Note: 
	 Use "Contact" element to supply any additional Address or Location information.
-->

<!ELEMENT  MasterAgreementRequestHeader (MaxAmount?, MinAmount?, 
					 MaxReleaseAmount?, MinReleaseAmount?, 
					 Contact*,Comments?, DocumentReference?,  Extrinsic*)> 
<!ATTLIST MasterAgreementRequestHeader
    agreementID    %string;		   #REQUIRED
    agreementDate  %datetime.tz;	   #REQUIRED
    type	   (value | quantity)	   "value"
    effectiveDate  %datetime.tz;	   #REQUIRED
    expirationDate %datetime.tz;	   #REQUIRED
    parentAgreementPayloadID %string;      #IMPLIED
    operation      (new | update | delete) "new"
>

<!--
    The representation of a  agreement line item as it needs to be for sending to a
    supplier.
    maxQuantity 
          maximum quantity for this particular lineItem
    minQuantity 
          minimum quantity for this particular lineItem
    maxReleaseQuantity 
          maximum quantity per release for this particular lineItem
    minReleaseQuantity 
          minimum quantity per release for this particular lineItem

    Note :
	  The #lineNumber attribute in the <ItemOut> will be used to specify the corresponding 
	  lineNumber on the Master Agreement in the Procurement Application.
	  At an implementation, level checks should be made to validate this.
    Note :
	  The quantity attribute in the ItemOut tag should be set to one and ignored at 
	  the Mater Agreement implementation processing stage. 
    Note :
	  The MaxReleaseAmount/Quantity and MinReleaseAmount/Quantity at an item level i
	  indicate the ItemLevel amounts and quantities per release.
-->
<!ELEMENT AgreementItemOut (MaxAmount?, MinAmount?, MaxReleaseAmount?, MinReleaseAmount?, ItemOut)>
<!ATTLIST AgreementItemOut
   maxQuantity		%r8;      #IMPLIED
   minQuantity		%r8;      #IMPLIED
   maxReleaseQuantity	%r8;      #IMPLIED
   minReleaseQuantity	%r8;      #IMPLIED
>

<!--
    The maximum amount  for something.
-->
<!ELEMENT MaxAmount (Money)>

<!--
    The minimum amount  for something.
-->
<!ELEMENT MinAmount (Money)>

<!--
    The contractual maximum amount per Release of this Master Agreement.
-->
<!ELEMENT MaxReleaseAmount (Money)>

<!--
 The contractual minimum amount per Release of this Master Agreement
-->
<!ELEMENT MinReleaseAmount (Money)>


<!--
    The maximum quantity  for something.
-->
<!ELEMENT MaxQuantity (#PCDATA)> <!-- number -->

<!--
    The minimum quantity  for something.
-->
<!ELEMENT MinQuantity (#PCDATA)> <!-- number -->


<!-- Followup

     Location to which future StatusUpdateRequest documents should be
     posted.  In general, this is the input location for any later
     documents which reference the current OrderRequest document.
-->
<!ELEMENT Followup (URL)>

<!-- PunchOut* Elements -->
<!--
    Definition of a PunchOut Setup Request.  This is the data that is sent
    to the external system that the procurement application is going to
    extract catalog data from.

    The BrowserFormPost element contains the URL we would like the browser
    re-directed to when the PunchOut shopping experience is finished (where
    the PunchOutOrder message should be returned).
-->
<!ELEMENT PunchOutSetupRequest (BuyerCookie, Extrinsic*, BrowserFormPost?,
                                Contact*, SupplierSetup?, ShipTo?,
                                SelectedItem?, ItemOut*)>
<!ATTLIST PunchOutSetupRequest
    operation  (create | inspect | edit | source)  #REQUIRED
>

<!ELEMENT BuyerCookie ANY> <!-- any valid XML data -->

<!ELEMENT SelectedItem (ItemID)>
<!ELEMENT SupplierSetup (URL)>

<!ELEMENT PunchOutSetupResponse (StartPage)>

<!--
    Definition of a PunchOut Order Message.  This is the data that is sent
    back to the procurement application from the external system that the
    PunchOut Request was targeted at.
-->
<!ELEMENT PunchOutOrderMessage (BuyerCookie, PunchOutOrderMessageHeader,
                                ItemIn*)>

<!--
     Header of a PunchOut Order Request.  This is the data that is sent from
     the supplier to transfer the supplier acquired shopping basket back to
     the buyer system.

     operationAllowed
          Highest operation allowed on the PunchOut shopping basket.
          "create" allows only later OrderRequest operations on these items.
          "inspect" adds a PunchOutSetupRequest with operation="inspect".
          And, "edit" allows operation="edit" in that later Setup request.

     quoteStatus 
          "pending"  - Identifies that the transaction is still pending
	  "final" - Identifies that the transaction is complete
-->
<!ELEMENT PunchOutOrderMessageHeader (SourcingStatus?, Total, ShipTo?, Shipping?, Tax?, SupplierOrderInfo?)>
<!ATTLIST PunchOutOrderMessageHeader
    operationAllowed  (create | inspect | edit)  #REQUIRED
    quoteStatus (pending|final) "final"
>

<!-- ====
    Other small Request elements.
==== -->

<!--
    Request to update the status of an earlier transaction.

    DocumentReference 
        A reference by payloadID to a cXML document to be updated.  This 
        element can be omitted only when InvoiceStatus is specified and
        the InvoiceStatus contains InvoiceIDInfo.

-->
<!ENTITY % cxml.statuses  "(PaymentStatus |
			    SourcingStatus | InvoiceStatus)">
<!ELEMENT StatusUpdateRequest  (DocumentReference?, Status, (%cxml.statuses;)?, Extrinsic*)>

<!--
    A reference to an attachment containing cXML document. 

    Attachment
        A reference to the attachment containing a cXML document.  The 
        attachment must be either a single, complete cXML document or another 
        MIME envelope containing a single, complete cXML document with 
        attachments.
-->
<!ELEMENT cXMLAttachment (Attachment)>

<!--
    Request to forward a cXML document to another party.  This Request
    occurs in multiple DTD files and is used depending on where (in which
    DTD) the forwarded message resides.

    cXMLAttachment
        A reference to the attachment containing the cXML document being 
        forwarded.  Refer to cXMLAttachment for more details.

    cXML
        Deprecated - Do Not Use.
-->
<!ELEMENT CopyRequest (cXMLAttachment | cXML)>

<!--
    Status for a pre-existing sourcing transaction. The textual content indicates
    the display information. "action" attribute defines the context of this message
    based on the value.

    approve : Approve the pending transaction
    deny : deny pending transaction
    cancel : cancel any preexisting transaction.

-->
<!ELEMENT SourcingStatus (#PCDATA)>
<!ATTLIST SourcingStatus
action    (approve | cancel | deny )  #IMPLIED
xml:lang %xmlLangCode; #REQUIRED>
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/schema/Modules/Transaction.mod#5 $
-->

<!--
    For better definitions of these Elements/Entities, refer to the cXML
    Transaction Specification documents.
-->

<!-- Basic financial elements used throughout -->

<!--
    The following defines a list of money amounts.

    DepositAmount
        The amount of deposit or prepayment.

    SubtotalAmount
        The subtotal amount.

    DiscountAmount
	Defines the discount amount

    SpecialHandlingAmount
        The special handling amount.

    ShippingAmount
        The shipping amount.

    GrossAmount
        The gross amount.

    NetAmount
        The net amount.

    DueAmount
        The due amount.

    FeeAmount
        Defines gross amount of the fee associated with a purchase
        in original currency.
-->
<!ELEMENT DepositAmount (Money)>

<!ELEMENT SubtotalAmount (Money)>

<!ELEMENT SpecialHandlingAmount (Money, Description?)>

<!ELEMENT ShippingAmount (Money)>

<!ELEMENT GrossAmount (Money)>

<!ELEMENT NetAmount (Money)>

<!ELEMENT DueAmount (Money)>

<!ELEMENT DiscountAmount (Money)>

<!ELEMENT FeeAmount (Money)>

<!--
    Defines a Purchasing Card element used for payment
-->
<!ELEMENT PCard (PostalAddress?)>
<!ATTLIST PCard
    number      %number;  #REQUIRED
    expiration  %date;    #REQUIRED
    name        %string;  #IMPLIED
>

<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id$
-->

<!--
    This element captures spend detail information.  SpendDetail can
    be used in the ItemIn and ItemOut and for the following types of
    messages:

        PunchOutSetupRequest
        PunchOutOrderMessage
        OrderRequest
        ConfirmationRequest

    But not for:

        MasterAgreementRequest

    TravelDetail
        Travel details for the current travel line item.

    LaborDetail
        Labor details for the current temporary labor line item.

    FeeDetail
        Fee details for the current fee line item.
        
    Extrinsic
    	Detail information for the any undefined spend category.  The name
    	attribute of the Extrinsic element should specify the type of the
    	spend category (e.g., (PrintDetail, ProjectLaborDetail))

-->
<!ELEMENT SpendDetail (TravelDetail | FeeDetail | LaborDetail | Extrinsic)>

<!--
    FeeDetail contains additional information about a line item for a fee, 
    which may or may not be recurring.

    UnitRate
        The amount(s) to be paid per unit (of time or other measure).
        In the case of multiple UnitRates (i.e., a "rate schedule"), it is
        customary and expected that each UnitRate will include a
        TermReference to distinguish them.

    Period
        The Period of time over which the fee is charged, if applicable.

    isRecurring 
        Indicates that the fee is recurring (charged more than once).
  -->
<!ELEMENT FeeDetail (UnitRate+, Period?) >
<!ATTLIST FeeDetail
	isRecurring (yes) #IMPLIED
>
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: $
-->

<!--
    LaborDetail contains information about an item for a temporary
    labor engagement. 

    UnitRate
        The amount(s) to be paid per unit (of time or other measure).
        In the case of multiple UnitRates (i.e., a "rate schedule"), it is
        customary and expected that each UnitRate will include a
        TermReference to distinguish them.

    Period
        The Period of time over which the service occurs.

    Contractor
        Identifies the contractor being engaged

    JobDescription
        Description of the job or work to be performed.

    Supervisor
        The person who is expected to supervise the contractor.

    WorkLocation
         Place where the work is expected to be performed.

    supplierReferenceCode
        The supplier's quote or proposal id, for cross-reference.
-->
<!ELEMENT LaborDetail (UnitRate+, Period, Contractor?, JobDescription?, Supervisor?, WorkLocation?, Extrinsic*)>
<!ATTLIST LaborDetail
	supplierReferenceCode %string; #IMPLIED
>
<!--    Text description of a job (service)-->
<!ELEMENT JobDescription (Description)>
<!--    Contact information for the person supervising a job (service)-->
<!ELEMENT Supervisor (Contact)>
<!--    Address of the location where a service is to be performed-->
<!ELEMENT WorkLocation (Address)>
<!--
    	Definition of a Contractor used in the context of temp labor. 
	The contractor is uniquely identified by a contractor identifier. 
	The piece of identification for a contractor is exchanged between 
	the buyer and the supplier prior to sending out order/timecards.
-->
<!--
    	Definition of a Contractor used in the context of temp labor. 
	The contractor is uniquely identified by a contractor identifier. 
	The piece of identification for a contractor is exchanged between 
	the buyer and the supplier prior to sending out order/timecards.
-->
<!ELEMENT Contractor (ContractorIdentifier, Contact)>

<!--
    	Definition of a ContractorIdentifier. uniquely identifies a contractor.
    
	domain
        	in what domain the identity is represented. This is for the
		end systems to know who assigned the id. buyerReferenceID 
		implies that it is something generated by the buyer system 
		and supplierReferenceID implies that it is something generated 
		by the supplier system/entered by the supplier.
-->
<!ELEMENT ContractorIdentifier (#PCDATA)>
<!ATTLIST ContractorIdentifier
        domain     	(supplierReferenceID|buyerReferenceID) #REQUIRED
>

<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/schema/Modules/Reference.mod#6 $
-->

<!--
    For better definitions of these Elements/Entities, refer to the cXML
    User's Guide and related documents.
-->

<!--
    The OrderReference element provides a clear reference to a prior
    OrderRequest document.  While the contained DocumentReference provides
    an unambiguous reference, the additional attributes of the
    OrderReference may allow the ConfirmationRequest and ShipNoticeRequest
    to be viewed independently.

    orderID
        The buyer system orderID for this request. Basically, what the PO
        number is today.  If present, must be copied directly from the
        referenced OrderRequest document's OrderRequestHeader.
    orderDate
        The date and time the order request was created.  If present, must
        be copied directly from the referenced OrderRequest document's
        OrderRequestHeader.
-->
<!ELEMENT OrderReference (DocumentReference)>
<!ATTLIST OrderReference
    orderID              %string;              #IMPLIED
    orderDate            %datetime.tz;         #IMPLIED
>

<!--
    Defines the ID of an order known to the buyer system.

    orderID
        The id of an order known to the buyer system.  Basically,
        what the PO number is today.

    orderDate
        The date and time the order was created.
-->
<!ELEMENT OrderIDInfo EMPTY>
<!ATTLIST OrderIDInfo
    orderID              %string;               #REQUIRED
    orderDate            %datetime.tz;          #IMPLIED
>

<!--
    Defines information related to an order.

        OrderReference
        The reference to the order being paid.

        OrderIDInfo
        The buyer system order id of the order.
-->
<!ELEMENT OrderInfo (OrderReference | OrderIDInfo)>


<!--
    The InvoiceReference element provides a clear reference to a prior
    InvoiceDetailRequest document.

    invoiceID
        The suplier system invoiceID for this request. Basically, what
        the Invoice number is today.  If present, must be copied
        directly from the referenced InvoiceDetailRequest document's
        InvoiceDetailRequestHeader.

    invoiceDate
        The invoice date.
-->
<!ELEMENT InvoiceReference (DocumentReference)>
<!ATTLIST InvoiceReference
    invoiceID              %string;               #IMPLIED
    invoiceDate            %datetime.tz;          #IMPLIED
>

<!--
    Defines the ID of an invoice known to the supplier system.

    invoiceID
        The id of an invoice known to the supplier system.

    invoiceDate
        The invoice date.
-->
<!ELEMENT InvoiceIDInfo EMPTY>
<!ATTLIST InvoiceIDInfo
    invoiceID              %string;               #REQUIRED
    invoiceDate            %datetime.tz;          #IMPLIED
>

<!--
    Defines the ID of a master agreement known to the buyer system.
    In InvoiceDetailRequest, this element identifies the master agreement
    of the release order to be invoiced.

    agreementID
        The id of a master agreement known to the buyer system.  Basically,
        what the master agreement number is today.

    agreementDate
        The date and time the master agreement request was created.
-->
<!ELEMENT MasterAgreementIDInfo EMPTY>
<!ATTLIST MasterAgreementIDInfo
    agreementID              %string;               #REQUIRED
    agreementDate            %datetime.tz;          #IMPLIED
>

<!--
    Defines a reference to an earlier MasterAgreementRequest document.
    In InvoiceDetailRequest, this element identifies the master agreement
    of the release order to be invoiced.

    DocumentReference
        The reference to an earlier MasterAgreementRequest document.

    agreementID
        The id of a master agreement known to the buyer system.  Basically,
        what the master agreement number is today.

    agreementDate
        The date and time the master agreement request was created.
-->
<!ELEMENT MasterAgreementReference (DocumentReference)>
<!ATTLIST MasterAgreementReference
    agreementID              %string;              #IMPLIED
    agreementDate            %datetime.tz;         #IMPLIED
>

<!--
    Identifies the carrier who will transport a shipment.

    domain
        Domain in which this value has meaning.  Recognized domains
        include:
        companyName - The legal name for this company.  In some cases, this
            could also be provided in a Contact element with role
            "carrierCorporate".  That option should be reserved for cases
            in which additional detail about the carrier appears in this
            element.
        SCAC - Standard Carrier Alpha Code (see
            http://users.erols.com/nmfta/Codes.htm)
        IATA - International Air Transport Association (see
            http://www.iata.org)
        AAR  - Association of American Railroads (see http://www.aar.org/)
        UIC  - International Union of Railways (see
            http://www.uic.asso.fr/)
        EAN  - European Article Numbering (see http://www.ean-ucc.org/)
        DUNS - D&B's Data Universal Numbering System (see
            http://www.dnb.com/dnbhome.htm)
-->
<!ELEMENT CarrierIdentifier (#PCDATA)>         <!-- string -->
<!ATTLIST CarrierIdentifier
    domain               %string;              #REQUIRED
>

<!--
    Identifier that appears on a shipment and through which additional
    detail about the shipment may be retrieved.  Defined by the carrier.
    Has meaning in the domain described by the CarrierIdentifier values.
    Therefore, CarrierIdentifier and ShipmentIdentifier should normally
    be used together.

    Conceptually, this is a tracking number.  Different carriers have
    different names for shipment identifiers.  Some call it a way bill
    number, others call it a pro number, and still others call it a bill of
    lading.  They all represent tracking numbers.
-->
<!ELEMENT ShipmentIdentifier (#PCDATA)>        <!-- string -->


<!--
    One language-specific string for the creator of an IdReference,
    e.g. IRS, BofA, UPS, Cisco, etc.

    xml:lang
        The language or locale in which the name of the creator is written.
-->
<!ELEMENT Creator (#PCDATA)>              <!-- string -->
<!ATTLIST Creator
   xml:lang              %xmlLangCode;         #REQUIRED
>

<!--
    Defines an ID reference.  Within the application context (for example,
    a certain pair of buyer and supplier), the (identifier, domain) pair
    should be unique.

    Creator
        The creator of this IdReference, e.g. BofA, UPS, Cisco, etc.

    Description
        Textual description of the IdReference. For human readability.

    identifier
        The unique identifier of the IdReference within the domain.

    domain
        The domain of the IdReference.  It should be one of the
        following:
        accountID, bankRoutingID, accountPayableID,
        accountReceivableID, bankAccountID, ibanID, abaRoutingNumber,
        bankNationalID, isoBicID, swiftID, bankBranchID, federalTaxID,
        stateTaxID, provincialTaxID, vatID, gstID, and taxExemptionID.
        supplierTaxID is deprecated and will be treated as federalTaxID.
        Other possible values could be 1099ID, courtRegisterID, etc.
-->
<!ELEMENT IdReference (Creator?, Description?)>
<!ATTLIST IdReference
    identifier      %string;                         #REQUIRED
    domain          %string;                         #REQUIRED
>

<!--
    Defines supplier sales order information related to an order.

    This is also used in PunchOutOrderMessage to indicate that the 
    supplier has created an order associated with the punchout order message.  
    The buyer can later cancel the sales order by sending an OrderRequest 
    of type "delete" that refers to the sales order by including the 
    SupplierOrderInfo element in the OrderRequestHeader

    orderID
        Supplier sales order id of this order.
-->
<!ELEMENT SupplierOrderInfo EMPTY>
<!ATTLIST SupplierOrderInfo
    orderID              %string;               #REQUIRED
>


<!-- 
    The ShipNoticeReference element provides a clear reference to a prior
    ShipNoticeRequest document.  While the contained DocumentReference provides
    an unambiguous reference, the additional attributes of the
    ShipNoticeReference may allow the ReceiptRequest to be viewed independently.

    DocumentReference
        The reference to an earlier ShipNoticeRequest.
        	
    shipNoticeID
        Unique identifier of the referenced ShipNoticeRequest.

    shipNoticeDate
        Date and time of the referenced ShipNoticeRequest.
-->
<!ELEMENT ShipNoticeReference (DocumentReference)>
<!ATTLIST ShipNoticeReference
	shipNoticeID %string; #IMPLIED
	shipNoticeDate %datetime.tz; #IMPLIED
>

<!-- 
    Defines ID of a Ship Notice known to the Buyer system.
 
    shipNoticeID
        Unique identifier of the referenced ShipNoticeRequest.

    shipNoticeDate
        Date and time of the referenced ShipNoticeRequest.
-->
<!ELEMENT ShipNoticeIDInfo EMPTY>
<!ATTLIST ShipNoticeIDInfo
    shipNoticeID              %string;               #REQUIRED
    shipNoticeDate            %datetime.tz;          #IMPLIED
>
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/schema/Modules/InvoiceDetail.mod#15 $
-->

<!--
    For better definitions of these Elements/Entities, refer to the cXML
    User's Guide and related documents.
-->

<!--
    Please note: In InvoiceDetailRequest, positive amounts are debit the
    buyer owes the supplier; negative amounts are credit given back to the
    buyer by the supplier.  For example, the supplier can use a SubtotalAmount
    of -50 USD to indicate credit of 50 USD given back to the buyer.

    Please also note that all amounts at invoice line level should add up
    to the total specified in InvoiceDetailSummary.
-->

<!--
    Defines a party involved in invoicing, including
    Issuer Of Invoice (issuerOfInvoice), Sold to (soldTo), Bill to (billTo),
    Remit to (remitTo), etc.  This element should NOT be used for specifying
    ship from and ship to.  For that purpose, InvoiceDetailShipping should
    be used.

    Contact
        Contact information of the invoice partner.  Allowed contact
        roles include issuerOfInvoice, soldTo, billTo, remitTo.

    IdReference
        Partner reference ID, including account #, ERP account payable ID,
        ERP account receivable ID, bank routing ID for remittance, supplier
        tax ID, VAT ID, 1099 ID, court register ID, tax exemption ID, etc.
-->
<!ELEMENT InvoicePartner (Contact, IdReference*)>

<!--
    Defines invoice header level indicators describing overall
    attributes of this invoice.  By default, all indicators are false.

    isHeaderInvoice
        True if this invoice uses InvoiceDetailHeaderOrder which contains
        header level invoice information without item details; false if this
        invoice uses InvoiceDetailOrder which contains item details.

    isVatRecoverable
        True if this entire invoice is VAT-recoverable.
-->
<!ELEMENT InvoiceDetailHeaderIndicator EMPTY>
<!ATTLIST InvoiceDetailHeaderIndicator
    isHeaderInvoice         (yes)      #IMPLIED
    isVatRecoverable        (yes)      #IMPLIED
>

<!--
    Defines invoice line level indicators indicating certain
    information is provided at invoice line level (in InvoiceDetailItem
    or InvoiceDetailOrderSummary).  By default, all indicators are false.

    If an indicator indicates certain information (e.g. tax, shipping, etc.)
    will be provided at invoice line level, for invoice lines which do
    not provide such information, they will be assumed to have values of
    zero, or "not available", whichever is appropriate, for that information.

    isTaxInLine
        True if tax info (Tax) is provided at invoice line level.

    isSpecialHandlingInLine
        True if special handling info (InvoiceDetailLineSpecialHandling)
        is provided at invoice line level.

    isShippingInLine
        True if shipping info (InvoiceDetailLineShipping) is provided
        at invoice line level.

    isDiscountInLine
        True if discount info (InvoiceDetailDiscount) is provided
        at invoice line level.

    isAccountingInLine
        True if accounting distribution info (Distribution) is provided at
        invoice line level.  If isHeaderInvoice is true, this indicator must
        be false because Distribution is only available at item level.
-->
<!ELEMENT InvoiceDetailLineIndicator EMPTY>
<!ATTLIST InvoiceDetailLineIndicator
    isTaxInLine                            (yes)      #IMPLIED
    isSpecialHandlingInLine                (yes)      #IMPLIED
    isShippingInLine                       (yes)      #IMPLIED
    isDiscountInLine                       (yes)      #IMPLIED
    isAccountingInLine                     (yes)      #IMPLIED
>

<!--
    Defines information related to an order, including order
    reference and related master agreement reference, if any.

    The various content options of InvoiceDetailOrderInfo are in order
    of preference, i.e., OrderReference is strongly recommended.  If
    that is not possible, MasterAgreementReference, MasterAgreementIDInfo,
    OrderIDInfo, or SupplierOrderInfo should be used, in that order.

    OrderReference
        The reference to the order being invoiced.

    MasterAgreementReference
        The reference to the corresponding master agreement if
        the order being invoiced is a release.

    MasterAgreementIDInfo
        The buyer system id of the corresponding master agreement if
        the order being invoiced is a release.

    OrderIDInfo
        The buyer system order id of the order.

    SupplierOrderInfo
        Supplier sales order info of this order.
-->
<!ELEMENT InvoiceDetailOrderInfo
    ( (OrderReference, (MasterAgreementReference | MasterAgreementIDInfo)?,
        SupplierOrderInfo?) |
      (MasterAgreementReference, OrderIDInfo?, SupplierOrderInfo?) |
      (MasterAgreementIDInfo, OrderIDInfo?, SupplierOrderInfo?) |
      (OrderIDInfo, SupplierOrderInfo?) |
      SupplierOrderInfo )>

<!--
    Defines the shipping information related to this invoice.

    Contact
        The ship from and ship to addresses. Both ship from and ship to
        must be specified.  Allowed contact roles are shipFrom, shipTo and
        carrierCorporate.

    CarrierIdentifier
        This list may include multiple identifiers for the same carrier.
        Elements in this list may appear in any order.  A particular
        identification domain (CarrierIdentifier@domain attribute
        value) must not appear more than once in an InvoiceDetailShipping
        element.  The identification provided by all elements of the
        CarrierIdentifier list must correspond to the same company.

    ShipmentIdentifier
        The tracking number of this shipment.

    DocumentReference
        The reference to an earlier ShipNoticeRequest.

    shippingDate
        The date and time this shipment leaves the supplier.
-->
<!ELEMENT InvoiceDetailShipping (Contact, Contact+,
                                 (CarrierIdentifier+, ShipmentIdentifier)?,
                                 DocumentReference?)>
<!ATTLIST InvoiceDetailShipping
    shippingDate             %datetime.tz;          #IMPLIED
>

<!--
    Defines a payment term.

    payInNumberOfDays
        The number of days after invoice date to pay in full.

    percentageRate
        Discount rate in the number of percentage for the payment
        term defined in the corresponding payInNumberOfDays.
        Positive means discount and negative means penalty.
-->
<!ELEMENT InvoiceDetailPaymentTerm EMPTY>
<!ATTLIST InvoiceDetailPaymentTerm
    payInNumberOfDays        %uint;         #REQUIRED
    percentageRate           %r8;           #REQUIRED
>

<!--
    Defines discount applied.

    Money
        The total discount in dollar (or other currency) amount.

    percentageRate
        The discount rate in percentage.
-->
<!ELEMENT InvoiceDetailDiscount (Money)>
<!ATTLIST InvoiceDetailDiscount
    percentageRate          %r8;           #IMPLIED
>

<!--
    Defines the summary information of an InvoiceDetailRequest.

    SubtotalAmount
        Sum of amount of all quantities.

    Tax
        Tax info.

    SpecialHandlingAmount
        Special handling charge.

    ShippingAmount
        Shipping charge.

    InvoiceDetailDiscount
        The total discount applied in this InvoiceDetailRequest.
        Its contained percentageRate attribute will be ignored
        if isDiscountInLine is true.

    GrossAmount
        Sum of subtotal, taxes, special handling
        charges, and shipping charges, before discounts.

    NetAmount
        Gross amount minus discounts.

    DepositAmount
        Total deposit/prepayment amount.

    DueAmount
        Total amount due and payable.  It equals NetAmount minus
        DepositAmount.  If InvoiceDetailRequestHeader@purpose is
        "creditMemo" or "lineLevelCreditMemo", this amount must be
        negative.  If InvoiceDetailRequestHeader@purpose is
        "debitMemo", this amount must be positive.
-->
<!ELEMENT InvoiceDetailSummary (SubtotalAmount, Tax, SpecialHandlingAmount?,
                                ShippingAmount?, GrossAmount?,
                                InvoiceDetailDiscount?, NetAmount,
                                DepositAmount?, DueAmount?)>

<!--
    Defines one or more serial numbers for accountable items that are
    being invoiced.
-->
<!ELEMENT SerialNumber (#PCDATA)> <!-- string -->


<!--
    Defines all references related to a line item in this invoice.

    ItemID
        The supplier part number of current line item, copied from
        OrderRequest.

    Description
        The line item description, copied from OrderRequest.

    ManufacturerPartID
        The manufacturer part number.

    ManufacturerName
        The name of the manufacturer.

    Country
        The country of origin of the current line item.

    SerialNumber
        Defines one or more serial numbers for accountable items that
        are being invoiced. If serial numbers are being reported, then
        the number of serial numbers should match the invoice
        quantity. The specification does not enforce this. Rather, it
        is the responsibility of buyer and supplier implementers to
        validate this count if appropriate. SerialNumber should be
        used instead of the InvoiceDetailItemReference@serialNumber
        attribute, which is now deprecated. It is not valid to use
        both the attribute and the SerialNumber element.

    lineNumber
        The line number of current line item, copied from OrderRequest.

    serialNumber
        The product serial number for the current line item.  This
        attribute is deprecated; the SerialNumber element should be
        used instead.

-->
<!ELEMENT InvoiceDetailItemReference (ItemID?, Description?,
                                      (ManufacturerPartID, ManufacturerName)?,
                                      Country?, SerialNumber*)>
<!ATTLIST InvoiceDetailItemReference
    lineNumber      %uint;         #REQUIRED
    serialNumber    %string;       #IMPLIED
>


<!--
    Defines all references related to a service line item in this invoice.

    Classification
        The classification information of the service.

    ItemID
        The supplier part number of the service.

    Description
        The description of the service.

    lineNumber
        The line number of current line item on the master
        agreement. It is required if the item being invoiced is part
        of a detailed master agreement that specifies detailed pricing
        terms at the line item or commodity level. It is optional if
        the item being invoiced is part of a master supplier agreement
        or blanket purchase order which do not contain detailed line
        item pricing information.

-->
<!ELEMENT InvoiceDetailServiceItemReference (Classification*, ItemID?, Description?)>
<!ATTLIST InvoiceDetailServiceItemReference
    lineNumber      %uint;         #IMPLIED
>


<!--
    Defines special handling information of the current invoice line.

    Description
        Textual description of the special handling.

    Money
        The special handling amount.
-->
<!ELEMENT InvoiceDetailLineSpecialHandling (Description?,
                                            Money)>

<!--
    Defines shipping information of the current invoice line.

    InvoiceDetailShipping
        The shipping details.

    Money
        The shipping amount.
-->
<!ELEMENT InvoiceDetailLineShipping (InvoiceDetailShipping, Money)>

<!--
    Defines a line item in the InvoiceDetailRequest.

    UnitOfMeasure
        The unit of measure.

    UnitPrice
        The unit price.

    InvoiceDetailItemReference
        The references related to this line item.

    SubtotalAmount
        The invoice subtotal of the current item = unit price x
        invoiced quantity.

    Tax
        The tax info for this line item.  It will be ignored if isTaxInLine
        is false.

    InvoiceDetailLineSpecialHandling
        The special handling info for this line item.  It will be ignored
        if isSpecialHandlingInLine is false.

    InvoiceDetailLineShipping
        The shipping info for this line item.  It will be ignored if
        isShippingInLine is false.

    GrossAmount
        The SubtotalAmount plus taxes, shipping, and special handling
        charges.

    InvoiceDetailDiscount
        The discount info for this line item.  It will be ignored if
        isDiscountInLine is false.

    NetAmount
        The GrossAmount minus discount amount.

    Distribution
        Accounting distribution information, including cost center, GL#, etc.
        It will be ignored if isAccountingInLine is false.

    Comments
        Textual comments for this line item.

    Extrinsic
        Additional information related to this line item.  Should not
        duplicate anything in InvoiceDetailItem or InvoiceDetailOrder.

    invoiceLineNumber
        Supplier defined ID for the current invoice line.  It should be
        unique across all invoice lines of the same InvoiceDetailRequest.

    quantity
        The quantity being actually invoiced for the current line
        item.

   referenceDate
        The reference date for the blanket order or contract item. This may indicate
        the date for which the line item is being invoiced.
        A use case is for seasonal items that vary the prices per period.

    inspectionDate
        The date when transfer of goods or delivery of services
        occurs. (Japanese law requires this.)
-->
<!ELEMENT InvoiceDetailItem (UnitOfMeasure, UnitPrice,
                             InvoiceDetailItemReference, SubtotalAmount?,
                             Tax?, InvoiceDetailLineSpecialHandling?,
                             InvoiceDetailLineShipping?, GrossAmount?,
                             InvoiceDetailDiscount?, NetAmount?,
                             Distribution*, Comments?, Extrinsic*)>
<!ATTLIST InvoiceDetailItem
    invoiceLineNumber        %uint;         #REQUIRED
    quantity                 %r8;           #REQUIRED
    referenceDate            %datetime.tz;  #IMPLIED
    inspectionDate           %datetime.tz;  #IMPLIED
>

<!--
    Defines a service line item in the InvoiceDetailRequest.

    InvoiceDetailServiceItemReference
        The references related to this line item.

    SubtotalAmount
        The invoice subtotal of the current service item. If unit price
        and invoiced quantity are specified, then subtotal should be
        equal to the product of them.

    Period
        The period during which the service was rendered.

    UnitRate
        The rate at which service item is charged.
        Use of the UnitRate element is recommended over the plain (UnitOfMeasure, UnitPrice) pair, 
        as the UnitRate element includes the rate code. For some services like temp labor services     
        UnitRate is required.

    UnitOfMeasure (deprecated)
        The unit of measure. For ex: HUR (per hour), MON (per month), etc. Use of
	  UnitRate is recommended over use of this element.

    UnitPrice (deprecated)
        The unit price if any. Use of UnitRate is recommended over use 
	  of this element.

    Tax
        The tax info for this line item.  It will be ignored if isTaxInLine
        is false.

    GrossAmount
        The SubtotalAmount plus taxes, shipping, and special handling
        charges.

    InvoiceDetailDiscount
        The discount info for this line item.  It will be ignored if
        isDiscountInLine is false.

    NetAmount
        The GrossAmount minus discount amount.

    Distribution
        Accounting distribution information, including cost center, GL#, etc.
        It will be ignored if isAccountingInLine is false.

    Comments
        Textual comments for this line item.

    (InvoiceLaborDetail | ...)
        Additonal details for a particular type of spend category will be specified here.
        For example, for timecard related(temp labor) services, extra info like the 
        TimeCard document reference, Contractor etc. can be specified.
    
    Extrinsic
        Additional information related to this line item.  Should not duplicate
        anything in InvoiceDetailItem or InvoiceDetailOrder. Other line item related
        attributes such as "union/non-union" should be specified in 
        extrinsic elements.

    invoiceLineNumber
        Supplier defined ID for the current invoice line.  It should be
        unique across all invoice lines of the same InvoiceDetailRequest.

    quantity
        The quantity being actually invoiced for the current line item. For regular
        service items, quantity represents the number of units of service rendered.
        For example, 2 hrs of lawn mowing service, where UnitOfMeasure is "HUR" and
        quantity is "2". For some services items, such as a milestone,
	quantity is optional. It is required if UnitPrice is specified.

    referenceDate
        The reference date for the service item. This may indicate the date at which
        the service line item is being invoiced.

    inspectionDate
        Refer to inspectionDate in InvoiceDetailItem.
-->
<!ELEMENT InvoiceDetailServiceItem (
                             InvoiceDetailServiceItemReference,
                             SubtotalAmount,
                             Period?, 
                             (UnitRate | (UnitOfMeasure, UnitPrice))?,
                             Tax?,
                             GrossAmount?,
                             InvoiceDetailDiscount?, NetAmount?,
                             Distribution*, Comments?, 
                             (InvoiceLaborDetail)?,
                             Extrinsic*)>
<!ATTLIST InvoiceDetailServiceItem
    invoiceLineNumber        %uint;         #REQUIRED
    quantity                 %r8;           #IMPLIED
    referenceDate            %datetime.tz;  #IMPLIED
    inspectionDate           %datetime.tz;  #IMPLIED
>


<!--
    Defines header level summary info of an order or master agreement in an invoice
    line.

    SubtotalAmount
        The invoice subtotal of this order or master agreement.

    Period
        The period during which the service was rendered. It should only be used for
        header level summary info for services, and it does not apply to goods.

    Tax
        The tax info for this order or master agreement. It will be ignored if
        isTaxInLine is false.

    InvoiceDetailLineSpecialHandling
        The special handling info for this order or master agreement. It will be
        ignored if isSpecialHandlingInLine is false. It should only be used for
        header level summary info for goods, and it does not apply to services.

    InvoiceDetailLineShipping
        The shipping info for this order. It will be ignored if isShippingInLine is
        false. It should only be used for header level summary info for goods, and
        it does not apply to services.

    GrossAmount
        The SubtotalAmount plus taxes, shipping, and special handling
        charges.

    InvoiceDetailDiscount
        The discount info for this order.  It will be ignored if
        isDiscountInLine is false.

    NetAmount
        The GrossAmount minus discount amount.

    Comments
        Textual comments for this line item.

    Extrinsic
        Additional information related to this line item.  Should not
        duplicate anything in InvoiceDetailOrderSummary or
        InvoiceDetailHeaderOrder.

    invoiceLineNumber
        Supplier defined ID for the current invoice line.  It should be
        unique across all invoice lines of the same InvoiceDetailRequest.

    inspectionDate
        Refer to inspectionDate in InvoiceDetailItem.
-->
<!ELEMENT InvoiceDetailOrderSummary (SubtotalAmount, Period?, Tax?,
                                     InvoiceDetailLineSpecialHandling?,
                                     InvoiceDetailLineShipping?,
                                     GrossAmount?, InvoiceDetailDiscount?,
                                     NetAmount?, Comments?, Extrinsic*)>
<!ATTLIST InvoiceDetailOrderSummary
    invoiceLineNumber        %uint;         #REQUIRED
    inspectionDate           %datetime.tz;  #IMPLIED
>


<!--
    Defines the header invoice information of an order without item details,
    used ONLY when isHeaderInvoice is true.

    In this case, an invoice line is an InvoiceDetailHeaderOrder
    and its invoice line number is InvoiceDetailHeaderOrder/
    InvoiceDetailOrderSummary@invoiceLineNumber.

    InvoiceDetailOrderInfo
        The reference information of the order.

    InvoiceDetailOrderSummary
        The header level invoice info of the order.
-->
<!ELEMENT InvoiceDetailHeaderOrder
    (InvoiceDetailOrderInfo, InvoiceDetailOrderSummary)>

<!--
    Defines the invoice information of an order or master agreement with item details,
    used ONLY when isHeaderInvoice is false.

    In this case, an invoice line is an InvoiceDetailItem and its invoice
    line number is InvoiceDetailItem@invoiceLineNumber.

    InvoiceDetailOrderInfo
        The reference information of the order or master agreement.

    InvoiceDetailItem
        The information of an item in the order.

    InvoiceDetailServiceItem
        The information of a service item in the master agreement.
-->
<!ELEMENT InvoiceDetailOrder (InvoiceDetailOrderInfo,
                              (InvoiceDetailItem | InvoiceDetailServiceItem)+)>


<!--
    Defines the header information of an InvoiceDetailRequest.

    InvoiceDetailHeaderIndicator
        Header level indicators describing overall attributes of this
        invoice.

    InvoiceDetailLineIndicator
        Header level indicators indicating certain information is
        provided at invoice line level (in InvoiceDetailItem or
        InvoiceDetailOrderSummary).

    InvoicePartner
        All partners invoiced in invoicing, including Sold to,
        Bill to, Remit to, Issuer of Invoice, etc.

    DocumentReference
        Reference to an earlier InvoiceDetailRequest.  If the
        attribute InvoiceDetailRequestHeader@operation is "delete",
        the DocumentReference is required and it must reference the
        original InvoiceDetailRequest document (with value "new" for
        its attribute InvoiceDetailRequestHeader@operation) during the
        same invoicing process.  If the attribute
        InvoiceDetailRequestHeader@purpose is "lineLevelCreditMemo",
        the DocumentReference is required and must identify the
        original invoice against which the credit is applied.  In all
        other situations, the DocumentReference is optional and, if it
        is provided, it must reference the InvoiceDetailRequest which
        is related to the current InvoiceDetailRequest.

    InvoiceIDInfo
        Reference to an earlier InvoiceDetailRequest.  If both
        DocumentReference and InvoiceIDInfo are provided, they must
        refer to the same invoice.

    InvoiceDetailShipping
        The shipping details of this invoice.  It will be ignored if
        isShippingInLine is true.

	InvoiceDetailPaymentTerm
        This is an older, deprecated way to define payment terms for this invoice.
        Use PaymentTerm instead.

    PaymentTerm
        This defines the payment terms for this invoice.

    Period
        The total period during which all the services (specified in this invoice)
        were rendered. This does not imply anything about the Period at the
        line level. 

    Comments
        Textual comments for this invoice.

    Extrinsic
        Additional information related to this invoice.  Should not
        duplicate anything in InvoiceDetailRequestHeader or
        InvoiceDetailRequest.
        For service related invoice, header level service extrinsics such 
        as "serviceLocation" can be specified here as follows.
        <Extrinsic name="serviceLocation">
            <Contact role="serviceLocation">
                <Name>XYZ Inc</Name>
                <PostalAddress>
                    <Street>123 Easy St</Street>
                    <City>Sunnyvale</City>
                    <State>California</State>
                    <PostalCode>94089</PostalCode>
                    <Country isoCountryCode="US">USA</Country>
                </PostalAddress>
            </Contact>
        </Extrinsic>

    invoiceID
        A supplier-generated identifier for this Invoice.  Identical to the
        Invoice Number which appears at the top of a physical Invoice.

    isInformationOnly
        True if this document is for buyer's information only (i.e. no action
        needs to be taken by the buyer). False if the buyer needs to take
        action upon receiving this document (e.g. submit payment or accept
        credit).  By default, it is false.

    purpose
        The purpose of this invoice:
        standard - This invoice is a standard billing statement from the
            supplier to the buyer.
        creditMemo - This invoice is a credit memo for giving credit back
            to the buyer by the supplier.  In this case, the attribute
            InvoiceDetailHeaderIndicator@isHeaderInvoice must be true.
            Also, the element InvoiceDetailSummary/DueAmount must be
            a negative amount.
        debitMemo - This invoice is a debit memo for billing a balance
            owed by the buyer to the supplier.  In this case, the attribute
            InvoiceDetailHeaderIndicator@isHeaderInvoice must be true.
            Also, the element InvoiceDetailSummary/DueAmount must be
            a positive amount.
        lineLevelCreditMemo - This invoice is a line item level credit memo 
            for giving credit back to the buyer by the supplier. In this 
            case, the attribute InvoiceDetailHeaderIndicator@isHeaderInvoice 
            is false. All the line item amounts and hence the 
            InvoiceDetailSummary/DueAmount must be a negative amount.

        By default, it is "standard".

    operation
        How this document is acting on the invoice:
        new - This document creates a new invoice.
        delete - This document cancels an existing invoice.  That existing
            invoice must be specified as DocumentReference.
        By default, it is "new".

    invoiceDate
        Date and time this Invoice was created (should be earlier than the
        document's timestamp).

    invoiceOrigin
        Indicates whether the invoice originated from the Buyer or Supplier. 
-->
<!ELEMENT InvoiceDetailRequestHeader (InvoiceDetailHeaderIndicator,
                                      InvoiceDetailLineIndicator,
                                      InvoicePartner*,
                                      DocumentReference?,
                                      InvoiceIDInfo?,
                                      InvoiceDetailShipping?,
                                      (InvoiceDetailPaymentTerm*|PaymentTerm*),
                                      Period?,
                                      Comments?,
                                      Extrinsic*)>
<!ATTLIST InvoiceDetailRequestHeader
    invoiceID     %string;                         #REQUIRED
    isInformationOnly
                  (yes)                            #IMPLIED
    purpose       (standard | creditMemo | debitMemo | lineLevelCreditMemo)
                                                   "standard"
    operation     (new | delete)                   "new"
    invoiceDate   %datetime.tz;                    #REQUIRED
    invoiceOrigin   
                  (supplier | buyer)               #IMPLIED
>

<!--
    InvoiceDetailRequest

    Transmits a invoice request to a buyer.  Provides order
    references, line item references, partners involved, accounting
    distribution, discount terms, shipping and special handling, applicable
    taxes, deposit and payment, contact and remittance information, etc.

    Suppliers can use InvoiceDetailRequest to send invoice for any
    portion of all or selected line items from single or multiple
    orders.  They can also use InvoiceDetailRequest to send cancel invoice
    (InvoiceDetailRequestHeader@operation is "delete"), credit memo,
    debit memo, or receipt (InvoiceDetailRequestHeader@isInformationOnly is
    "yes").

    This document must be sent to the location specified in the buyer's
    ProfileResponse.

    InvoiceDetailRequestHeader
        The header information of this invoice.

    InvoiceDetailOrder
        The invoice information of an order with item details, used ONLY
        when isHeaderInvoice is false.

    InvoiceDetailHeaderOrder
        The header invoice information of an order without item details,
        used ONLY when isHeaderInvoice is true.

    InvoiceDetailSummary
        The summary information of this invoice.
-->
<!ELEMENT InvoiceDetailRequest
    (InvoiceDetailRequestHeader,
     (InvoiceDetailOrder+ | InvoiceDetailHeaderOrder+),
     InvoiceDetailSummary)>



<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id$
-->

<!--
    For better definitions of these Elements/Entities, refer to the cXML
    User's Guide and related documents.
-->

<!--
    Defines invoice information specific to labor items.

    Contractor
        The contractor whose work is being invoiced.

    JobDescription
        Detailed description of the job for this labor line item.

    Supervisor
        Supervisor of the contractor whose work is being invoiced.

    WorkLocation
        The work location of the contractor whose work is being invoiced.

    InvoiceTimeCardDetail
        Invoice details for labor reported on a time card. The pay code for this invoice
        line item is in the UnitRate of the containing InvoiceDetailServiceItem element.
-->
<!ELEMENT InvoiceLaborDetail (Contractor?, JobDescription?, Supervisor?, WorkLocation?,  InvoiceTimeCardDetail?)>

<!--
    InvoiceTimeCardDetail
        This element is used to capture details about a timecard related (temp
        labor) service.

    TimeCardReference
        The TimeCardReference element provides a clear reference to a prior TimeCard
        cXML document.

    TimeCardIDInfo
        Unique ID for the timecard as sent on the TimeCard document during
        TimeCardInfoRequest or TimeCardRequest messages.
-->
<!ELEMENT InvoiceTimeCardDetail ((TimeCardReference | TimeCardIDInfo))>
<!ELEMENT TimeCardReference (DocumentReference)>
<!ATTLIST TimeCardReference
	timeCardID %string; #IMPLIED
>

<!--
    TimeCardIDInfo
        Defines the unique ID of the timecard known to the buyer and supplier systems.

    timeCardID
	  Unique ID for the timecard as sent on the TimeCard document during 
	  TimeCardInfoRequest or TimeCardRequest requests
-->
<!ELEMENT TimeCardIDInfo EMPTY>
<!ATTLIST TimeCardIDInfo
	timeCardID %string; #REQUIRED
>
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/schema/Modules/InvoiceEntities.mod#2 $
-->

<!--
     Top-level entities used in Transport.mod.  Defined here to allow easy
     extention of the cXML specification (using additional DTDs) without
     redefining these entities.
-->

<!ENTITY % cxml.requests "(InvoiceDetailRequest)">

<!ENTITY % cxml.messages "">

<!ENTITY % cxml.responses "">
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/schema/Modules/Transport.mod#6 $
-->

<!--
    For better definitions of these Elements/Entities, refer to the cXML
    Protocol Specification documents.
-->

<!--
    Defines the set of known valid cXML digital signature versions
-->
<!ENTITY % cxml.signatureVersions "(1.0)">

<!--
    cXML envelope

    version
        Version of this cXML transmission.  Should be less than or equal
    to the version portion of the SYSTEM identifier for this document.

    payloadID
        A unique identifier for this document.

    timestamp
        The date and time at which this document was originally created.

    signatureVersion
        If present, specifies the cXML digital signature version to
        which this document conforms.  This implies that the
        ds:Signature element must be present.  It is an error if this
        attribute is present and the document does not conform to the
        specified signature version.  If absent, the document is not
        signed.

    xml:lang
        The default locale for all strings (not formatted items such as
    dates, times and numbers) in this document.  This attribute will be
    required in a future version of cXML.  (Leaving it out is
    deprecated.)
-->
<!ELEMENT cXML (((Header, (Message | Request)) | Response), ds:Signature*)>
<!ATTLIST cXML
    version    %string;       "&cxml.version;"
    payloadID  %string;       #REQUIRED
    timestamp  %datetime.tz;  #REQUIRED
    signatureVersion %cxml.signatureVersions; #IMPLIED
    xml:lang   %xmlLangCode;  #IMPLIED
>

<!-- header -->
<!ELEMENT Header (From, To, Sender, (Path, OriginalDocument)?)>

<!ELEMENT From (Credential+, Correspondent?)>
<!ELEMENT To (Credential+, Correspondent?)>
<!ELEMENT Sender (Credential+, UserAgent)>

<!--
    Path. A list of nodes that records the path taken by a user through 
    a punchout chaining scenario.
-->
<!ELEMENT Path (Node+)>

<!--
    A Node is any entity connected to a Network.
    
    type
        A node can define itself as a router node or a copy node.  Routers
    assume responsibility for the transaction.  Copy Nodes request to only
    be aware of the transaction.
    
    itemDetailsRequired
        Intermediary Nodes may want to support special operations without
    having to store specific information required to fulfill that operation.
    This attribute tells the previous node to send ItemDetail information
    when performing a PunchOutSetupRequest edit/inspect operation.
-->
<!ELEMENT Node (Credential+)>
<!ATTLIST Node
    type (copy | route) #REQUIRED
    itemDetailsRequired (yes) #IMPLIED
>


<!--
    Identifies the previous document in the situation that a router node
    forwards a message or request on to a more distant node.
    
    payloadID
        The payloadId of the original document.
-->
<!ELEMENT OriginalDocument EMPTY>
<!ATTLIST OriginalDocument
    payloadID %string; #REQUIRED
>

<!--
    A textual string representing who the UserAgent is conducting the cXML
    conversation. Analogous to UserAgent for HTTP conversations.
-->
<!ELEMENT UserAgent (#PCDATA)>

<!--
    DEPRECATED 
    Do not use this element.
-->
<!ELEMENT DigitalSignature ANY>
<!ATTLIST DigitalSignature
    type      %string;  "PK7 self-contained"
    encoding  %string;  "Base64"
>

<!--
    A shared secret. Typically, this is a username/password type of secret
    exchanged through a secure transport before communication takes place.
-->
<!ELEMENT SharedSecret ANY>

<!--
    Represents an identity for a credential.

    lastChangedTimestamp
       When the underlying object last changed in the originating system.
       This is used in cases where the same object (e.g. a buyer
       organization) is replicated, and kept synchronized, across two
       systems.
-->
<!ELEMENT Identity ANY>
<!ATTLIST Identity
    lastChangedTimestamp  %datetime.tz;  #IMPLIED
>

<!--
    A Credential Message Authentication Code (MAC).  This is used in
    situations where one party (the sender) must prove to another (the
    receiver) that it is authenticated by a shared secret with a third
    party trusted by both.

    The MAC should be computed by the trusted third party and
    transferred to the sender.  The MAC should be opaque to the sender
    (i.e., it should be secure and non-reversible).  The MAC should
    use as its inputs enough information to accomplish the following
    goals:

    (1) The MAC must prove to the receiver that it really originated
    with the trusted third party.  E.g., the MAC could use a shared
    secret between the receiver and the trusted third party as its
    secret key.

    (2) The MAC should be usable only by a certain sender.  E.g., the
    MAC could authenticate an identifier for the sending organization.

    (3) The MAC should prove that the sender is authorized to send on
    behalf of the From organization.  E.g., the MAC could authenticate
    an identifier for the From organization.

    (4) The MAC should limit the risk of the MAC being compromised and
    used to impersonate the sender by another party communicating with
    the receiver.  E.g., the MAC could authenticate an expiration date
    or sequence number.

    type
        An implementation-dependent identifier for the exact data
        being authenticated and the method in which it is formatted
        for authentication.  Currently the only supported value is
        "FromSenderCredentials".

    algorithm
        An implementation-dependent identifier for the exact MAC
        algorithm used on the data.  Currently the only supported
        value is "HMAC-SHA1-96".

    creationDate
        The time at which this MAC was issued.  The receiver must not
        accept the MAC before this time.

    expirationDate
        The time at which this MAC expires.  The receiver must not
        accept the MAC after this time.
-->
<!ELEMENT CredentialMac (#PCDATA)>
<!ATTLIST CredentialMac
    type           %string;      #REQUIRED
    algorithm      %string;      #REQUIRED
    creationDate   %datetime.tz; #REQUIRED
    expirationDate %datetime.tz; #REQUIRED
>

<!--
    A combination of an Identity and authentication element. If the
    authentication element is present, it strongly authenticates who/what
    someone is.  The authentication element should not be sent within Message
    documents transported via an end user's browser.  One-way communication
    must be authenticated in the transport layer.

    domain
        In what domain is this Credential represented?
    type
        Does this Credential identify a marketplace or one of its member
        companies?  A Credential without this attribute describes a member
        company or unaffiliated buying organization.
-->
<!ENTITY % cxml.authentication  "SharedSecret |
                                 DigitalSignature |
                                 CredentialMac"
>
<!ELEMENT Credential (Identity, (%cxml.authentication;)?)>
<!ATTLIST Credential
    domain  %string;      #REQUIRED
    type    (marketplace) #IMPLIED
>

<!--
    Status of a Response or Message.  If present, the element content
    describes specifics of a problem.

    code
        HTTP or cXML-specific status code.

    text
        Textual version of the status code (not specific issue).

    xml:lang
        The language in which the text attribute and element content are
    written.  This attribute will be required in a future version of
    cXML.  (Leaving it out is deprecated.)
-->
<!ELEMENT Status (#PCDATA)>
<!ATTLIST Status
    code     %uint;        #REQUIRED
    text     %string;      #REQUIRED
    xml:lang %xmlLangCode; #IMPLIED
>

<!--
    Message

    When Status not present, '<Status code="200" text="OK" />' is implied.
-->
<!ELEMENT Message (Status? %cxml.messages;)>
<!ATTLIST Message
    deploymentMode  (production | test)  "production"
    inReplyTo       %string;  #IMPLIED
    Id              ID        #IMPLIED
>

<!-- request -->
<!ELEMENT Request (%cxml.requests;)>
<!ATTLIST Request
    deploymentMode  (production | test)  "production"
    Id              ID        #IMPLIED
>

<!-- response -->
<!ELEMENT Response (Status %cxml.responses;)>
<!ATTLIST Response
    Id              ID        #IMPLIED
>

<!--
    This element includes signed cXML-specific details about the
    document being signed.  When a cXML document is signed, this
    element must appear inside the first ds:Object element in the
    ds:Signature element.

    signatureVersion
        This specifies the cXML signature version to which this
        document conforms.  It is an error if this attribute value
        does not exactly match the value of the signatureVersion
        attribute from the top-level cXML element.  It is an error if
        the document does not conform to the specified cXML signature
        version.

    payloadID
        Specifies the payloadID of the document.  It is an error if
        the value of this attribute does not exactly match the value
        of the payloadID attribute from the top-level cXML element.

    Id
        This identifies this cXMLSignedInfo element for purposes of
        the signature.  This attribute must always be present and
        should always have the value "cXMLSignedInfo"

-->
<!ELEMENT cXMLSignedInfo EMPTY>
<!ATTLIST cXMLSignedInfo
    signatureVersion    %cxml.signatureVersions;        #REQUIRED
    payloadID           %string;                        #REQUIRED
    Id                  ID                              #REQUIRED
>

<!--
    This element includes the contact information of the organisation
    to/from whom the document is sent/received.

    preferredLanguage
        optional language which the organisation, identified by this 
        element, would prefer to use. Refer to the definition of 
        xmlLangCode entity.
-->
<!ELEMENT Correspondent (Contact+, Extrinsic*)>
<!ATTLIST Correspondent
    preferredLanguage     %xmlLangCode;        #IMPLIED
><!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/Modules/Profile.mod#6 $
-->

<!--
    For more information about W3C XML signatures, refer to the
    following URL.  Portions of this DTD are derived from information
    contained therein.
    http://www.w3.org/TR/xmldsig-core/
-->

<!-- DTD for XML Signatures
    http://www.w3.org/2000/09/xmldsig#
    Joseph Reagle $last changed 20001215$

    http://www.w3.org/2000/09/xmldsig#
    $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $

    Copyright 2001 The Internet Society and W3C (Massachusetts Institute
    of Technology, Institut National de Recherche en Informatique et en
    Automatique, Keio University). All Rights Reserved.
    http://www.w3.org/Consortium/Legal/

    This document is governed by the W3C Software License [1] as described
    in the FAQ [2].

    [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
    [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
-->

<!--

The following entity declarations enable external/flexible content in
the Signature content model.

#PCDATA emulates schema string; when combined with element types it
emulates schema's mixed content type.

%foo.ANY permits the user to include their own element types from
other namespaces, for example:
 <!ENTITY % KeyValue.ANY '| ecds:ECDSAKeyValue'>
 ...
 <!ELEMENT ecds:ECDSAKeyValue (#PCDATA)  >

-->

<!ENTITY % Object.ANY '|xades:QualifyingProperties|cXMLSignedInfo|Extrinsic'>
<!ENTITY % Method.ANY ''>
<!ENTITY % Transform.ANY ''>
<!ENTITY % SignatureProperty.ANY ''>
<!ENTITY % KeyInfo.ANY ''>
<!ENTITY % KeyValue.ANY ''>
<!ENTITY % PGPData.ANY ''>
<!ENTITY % X509Data.ANY ''>
<!ENTITY % SPKIData.ANY ''>



<!-- Start Core Signature declarations, these should NOT be altered -->

<!ELEMENT ds:Signature (ds:SignedInfo, ds:SignatureValue, ds:KeyInfo?, ds:Object*)  >
<!ATTLIST ds:Signature  
	xmlns:ds	CDATA	#FIXED 'http://www.w3.org/2000/09/xmldsig#'
	xmlns:xades	CDATA	#FIXED 'http://uri.etsi.org/01903/v1.3.2#'
	Id  		ID	#IMPLIED >

<!ELEMENT ds:SignatureValue (#PCDATA) >
<!ATTLIST ds:SignatureValue  
         Id  ID      #IMPLIED>

<!ELEMENT ds:SignedInfo (ds:CanonicalizationMethod, 
	ds:SignatureMethod,  ds:Reference+)  >
<!ATTLIST ds:SignedInfo  
	Id	 ID 	 #IMPLIED 
>

<!ELEMENT ds:CanonicalizationMethod (#PCDATA %Method.ANY;)* > 
<!ATTLIST ds:CanonicalizationMethod 
	Algorithm CDATA #REQUIRED > 

<!ELEMENT ds:SignatureMethod (#PCDATA|ds:HMACOutputLength %Method.ANY;)* >
<!ATTLIST ds:SignatureMethod 
	Algorithm CDATA #REQUIRED > 

<!ELEMENT ds:Reference (ds:Transforms?, ds:DigestMethod, ds:DigestValue)  >
<!ATTLIST ds:Reference
	Id	ID	#IMPLIED
	URI	CDATA	#IMPLIED
	Type	CDATA	#IMPLIED>


<!ELEMENT ds:Transforms (ds:Transform+)>

<!ELEMENT ds:Transform (#PCDATA|ds:XPath %Transform.ANY;)* >
<!ATTLIST ds:Transform 
	Algorithm    CDATA    #REQUIRED >

<!ELEMENT ds:XPath (#PCDATA) >

<!ELEMENT ds:DigestMethod (#PCDATA %Method.ANY;)* >
<!ATTLIST ds:DigestMethod  
	Algorithm		CDATA	#REQUIRED >

<!ELEMENT ds:DigestValue  (#PCDATA)  >

<!ELEMENT ds:KeyInfo	(#PCDATA|ds:KeyName|ds:KeyValue|ds:RetrievalMethod|
           ds:X509Data|ds:PGPData|ds:SPKIData|ds:MgmtData %KeyInfo.ANY;)* >
<!ATTLIST ds:KeyInfo
	Id	ID	 #IMPLIED >

<!-- Key Information -->

<!ELEMENT ds:KeyName (#PCDATA) >
<!ELEMENT ds:KeyValue (#PCDATA|ds:DSAKeyValue|ds:RSAKeyValue %KeyValue.ANY;)* >
<!ELEMENT ds:MgmtData (#PCDATA) >

<!ELEMENT ds:RetrievalMethod (ds:Transforms?) >
<!ATTLIST ds:RetrievalMethod
  URI	CDATA #REQUIRED 
  Type	CDATA #IMPLIED > 

<!-- X.509 Data -->

<!ELEMENT ds:X509Data ((ds:X509IssuerSerial | ds:X509SKI | ds:X509SubjectName |
                    ds:X509Certificate | ds:X509CRL )+ %X509Data.ANY;)>
<!ELEMENT ds:X509IssuerSerial (ds:X509IssuerName, ds:X509SerialNumber) >
<!ELEMENT ds:X509IssuerName (#PCDATA) >
<!ELEMENT ds:X509SubjectName (#PCDATA) >
<!ELEMENT ds:X509SerialNumber (#PCDATA) >
<!ELEMENT ds:X509SKI (#PCDATA) >
<!ELEMENT ds:X509Certificate (#PCDATA) >
<!ELEMENT ds:X509CRL (#PCDATA) >

<!-- PGPData -->

<!ELEMENT ds:PGPData ((ds:PGPKeyID, ds:PGPKeyPacket?) | (ds:PGPKeyPacket) %PGPData.ANY;) >
<!ELEMENT ds:PGPKeyPacket  (#PCDATA)  >
<!ELEMENT ds:PGPKeyID  (#PCDATA)  >

<!-- SPKI Data -->

<!ELEMENT ds:SPKIData (ds:SPKISexp %SPKIData.ANY;)  >
<!ELEMENT ds:SPKISexp  (#PCDATA)  >

<!-- Extensible Content -->

<!ELEMENT ds:Object (#PCDATA|ds:Signature|ds:SignatureProperties|ds:Manifest %Object.ANY;)* >
<!ATTLIST ds:Object  
	Id	ID	#IMPLIED
	MimeType	CDATA	#IMPLIED
	Encoding	CDATA	#IMPLIED >

<!ELEMENT ds:Manifest (ds:Reference+)  >
<!ATTLIST ds:Manifest  
	Id	ID	#IMPLIED >

<!ELEMENT ds:SignatureProperties (ds:SignatureProperty+)  >
<!ATTLIST ds:SignatureProperties  
	Id	ID	 #IMPLIED  >

<!ELEMENT ds:SignatureProperty (#PCDATA %SignatureProperty.ANY;)* >
<!ATTLIST ds:SignatureProperty  
	Target 	CDATA	 #REQUIRED
	Id	ID	 #IMPLIED  >

<!-- Algorithm Parameters -->

<!ELEMENT ds:HMACOutputLength (#PCDATA) >

<!ELEMENT ds:DSAKeyValue ((ds:P, ds:Q)?, ds:G?, ds:Y, ds:J?, (ds:Seed, ds:PgenCounter)?) >
<!ELEMENT ds:P (#PCDATA) >
<!ELEMENT ds:Q (#PCDATA) >
<!ELEMENT ds:G (#PCDATA) >
<!ELEMENT ds:Y (#PCDATA) >
<!ELEMENT ds:J (#PCDATA) >
<!ELEMENT ds:Seed (#PCDATA) >
<!ELEMENT ds:PgenCounter (#PCDATA) >

<!ELEMENT ds:RSAKeyValue (ds:Modulus, ds:Exponent) > 
<!ELEMENT ds:Modulus (#PCDATA) >
<!ELEMENT ds:Exponent (#PCDATA) >
<!--
    For cXML license agreement information, please see
    http://www.cxml.org/home/license.asp

    $Id: //ariba/cxml/Modules/Profile.mod#6 $
-->

<!--
    For more information about XAdES, refer to the following URL.
    Portions of this DTD are derived from information contained therein.
    http://uri.etsi.org/01903/v1.3.2#
-->

<!ENTITY % Any.ANY ' '>
<!ENTITY % XMLTimeStamp.ANY ' '>
<!ENTITY % Method.ANY ' '>

<!-- Start Any -->

<!ELEMENT xades:Any (#PCDATA   %Any.ANY;)*>

<!-- End Any -->

<!-- Start ObjectIdentifier -->

<!ELEMENT xades:ObjectIdentifier (xades:Identifier, xades:Description?, 
xades:DocumentationReferences?)>
<!ELEMENT xades:Identifier (#PCDATA)>
<!ATTLIST xades:Identifier
	Qualifier (OIDAsURI | OIDAsURN) #IMPLIED
>
<!ELEMENT xades:Description (#PCDATA)>
<!ELEMENT xades:DocumentationReferences (xades:DocumentationReference)+>
<!ELEMENT xades:DocumentationReference (#PCDATA)>

<!-- End ObjectIdentifier -->

<!-- Start EncapsulatedPKIData -->

<!ELEMENT xades:EncapsulatedPKIData (#PCDATA)>
<!ATTLIST xades:EncapsulatedPKIData
	Id ID #IMPLIED
	Encoding CDATA #IMPLIED
>

<!-- End EncapsulatedPKIData -->

<!-- Start time-stamp container types -->

<!ELEMENT xades:Include EMPTY>
<!ATTLIST xades:Include
	URI CDATA #REQUIRED
	referencedData CDATA #IMPLIED
>

<!ELEMENT xades:ReferenceInfo (ds:DigestMethod, ds:DigestValue)>
<!ATTLIST xades:ReferenceInfo
	Id ID #IMPLIED
	URI CDATA #IMPLIED
>
<!ELEMENT xades:XAdESTimeStamp (xades:Include*, ds:CanonicalizationMethod?, 
(xades:EncapsulatedTimeStamp | xades:XMLTimeStamp)+)>
<!ATTLIST xades:XAdESTimeStamp
	Id ID #IMPLIED
>

<!ELEMENT xades:OtherTimeStamp (xades:ReferenceInfo+, ds:CanonicalizationMethod?, 
(xades:EncapsulatedTimeStamp | xades:XMLTimeStamp))>
<!ATTLIST xades:OtherTimeStamp
	Id ID #IMPLIED
>

<!ELEMENT xades:EncapsulatedTimeStamp (#PCDATA)>
<!ATTLIST xades:EncapsulatedTimeStamp
	Id ID #IMPLIED
>

<!ELEMENT xades:XMLTimeStamp (#PCDATA  %XMLTimeStamp.ANY; )*>

<!-- End time-stamp tokens container  -->

<!-- Start container types -->

<!-- Start QualifyingProperties -->

<!ELEMENT xades:QualifyingProperties (xades:SignedProperties?, xades:UnsignedProperties?)>
<!ATTLIST xades:QualifyingProperties
	Target CDATA #REQUIRED
	Id ID #IMPLIED
	xmlns:xades	CDATA	#FIXED 'http://uri.etsi.org/01903/v1.3.2#'
>

<!ELEMENT xades:SignedProperties (xades:SignedSignatureProperties, 
xades:SignedDataObjectProperties?)>
<!ATTLIST xades:SignedProperties
	Id ID #IMPLIED
>

<!ELEMENT xades:UnsignedProperties (xades:UnsignedSignatureProperties?, 
xades:UnsignedDataObjectProperties?)>
<!ATTLIST xades:UnsignedProperties
	Id ID #IMPLIED
>

<!-- End QualifyingProperties -->

<!-- Start SignedSignatureProperties, SignedDataObjectProperties, 
UnsignedSignatureProperties, UnsignedDataObjectProperties -->

<!ELEMENT xades:SignedSignatureProperties (xades:SigningTime?, xades:SigningCertificate?, 
xades:SignaturePolicyIdentifier?, xades:SignatureProductionPlace?, xades:SignerRole?)>
<!ATTLIST xades:SignedSignatureProperties
	Id ID #IMPLIED
>

<!ELEMENT xades:SignedDataObjectProperties (xades:DataObjectFormat*, 
xades:CommitmentTypeIndication*, xades:AllDataObjectsTimeStamp*, 
xades:IndividualDataObjectsTimeStamp*)>
<!ATTLIST xades:SignedDataObjectProperties
	Id ID #IMPLIED
>

<!ELEMENT xades:UnsignedSignatureProperties (xades:CounterSignature | xades:SignatureTimeStamp 
| xades:CompleteCertificateRefs | xades:CompleteRevocationRefs | xades:AttributeCertificateRefs
 | xades:AttributeRevocationRefs | (xades:SigAndRefsTimeStamp | xades:RefsOnlyTimeStamp) | 
xades:CertificateValues | xades:RevocationValues | xades:AttrAuthoritiesCertValues 
| xades:AttributeRevocationValues | xades:ArchiveTimeStamp)+>
<!ATTLIST xades:UnsignedSignatureProperties
	Id ID #IMPLIED
>

<!ELEMENT xades:UnsignedDataObjectProperties (xades:UnsignedDataObjectProperty*)>
<!ATTLIST xades:UnsignedDataObjectProperties
	Id ID #IMPLIED
>

<!ELEMENT xades:UnsignedDataObjectProperty (#PCDATA   %Any.ANY;)*>

<!-- End SignedSignatureProperties, SignedDataObjectProperties, 
UnsignedSignatureProperties, UnsignedDataObjectProperties -->

<!-- Start QualifyingPropertiesReference -->

<!ELEMENT xades:QualifyingPropertiesReference EMPTY>
<!ATTLIST xades:QualifyingPropertiesReference
	URI CDATA #REQUIRED
	Id ID #IMPLIED
>

<!-- End QualifyingPropertiesReference -->

<!-- End container types -->

<!-- Start SigningTime -->

<!ELEMENT xades:SigningTime (#PCDATA)>

<!-- End SigningTime -->

<!-- Start SigningCertificate -->

<!ELEMENT xades:SigningCertificate (xades:Cert+)>
<!ELEMENT xades:Cert (xades:CertDigest, xades:IssuerSerial)>
<!ATTLIST xades:Cert
	URI CDATA #IMPLIED
>
<!ELEMENT xades:CertDigest (ds:DigestMethod, ds:DigestValue)>
<!ELEMENT xades:IssuerSerial (ds:X509IssuerName, ds:X509SerialNumber)>
<!ELEMENT xades:X509IssuerName (#PCDATA)>
<!ELEMENT xades:X509SerialNumber (#PCDATA)>

<!-- End SigningCertificate -->

<!-- Start SignaturePolicyIdentifier -->

<!ELEMENT xades:SignaturePolicyIdentifier (xades:SignaturePolicyId | 
xades:SignaturePolicyImplied)>
<!ELEMENT xades:SignaturePolicyImplied ANY>
<!ELEMENT xades:SignaturePolicyId (xades:SigPolicyId, ds:Transforms?, xades:SigPolicyHash, 
xades:SigPolicyQualifiers?)>
<!ELEMENT xades:SigPolicyId (xades:Identifier, xades:Description?, xades:DocumentationReferences?)>
<!ELEMENT xades:SigPolicyHash (ds:DigestMethod, ds:DigestValue)>
<!ELEMENT xades:SigPolicyQualifiers (xades:SigPolicyQualifier+)>
<!ELEMENT xades:SigPolicyQualifier (#PCDATA|xades:SPURI %Any.ANY; )*>

<!-- End SignaturePolicyIdentifier -->

<!-- Start SPURI and SPUserNotice -->

<!ELEMENT xades:SPURI (#PCDATA)>
<!ELEMENT xades:SPUserNotice (xades:NoticeRef?, xades:ExplicitText?)>
<!ELEMENT xades:NoticeRef (xades:Organization, xades:NoticeNumbers)>
<!ELEMENT xades:ExplicitText (#PCDATA)>
<!ELEMENT xades:Organization (#PCDATA)>
<!ELEMENT xades:NoticeNumbers (xades:int*)>
<!ELEMENT xades:int (#PCDATA)>

<!-- End SPURI and SPUserNotice -->

<!-- Start CounterSignature -->

<!ELEMENT xades:CounterSignature (ds:Signature)>

<!-- End CounterSignature -->

<!-- Start DataObjectFormat -->

<!ELEMENT xades:DataObjectFormat (xades:Description?, xades:ObjectIdentifier?, xades:MimeType?, 
xades:Encoding?)>
<!ATTLIST xades:DataObjectFormat
	ObjectReference CDATA #REQUIRED
>
<!ELEMENT xades:MimeType (#PCDATA)>
<!ELEMENT xades:Encoding (#PCDATA)>

<!-- End DataObjectFormat -->

<!-- Start CommitmentTypeIndication -->

<!ELEMENT xades:CommitmentTypeIndication (xades:CommitmentTypeId, (xades:ObjectReference+ | 
xades:AllSignedDataObjects), xades:CommitmentTypeQualifiers?)>
<!ELEMENT xades:CommitmentTypeId (xades:Identifier, xades:Description?, 
xades:DocumentationReferences?)>
<!ELEMENT xades:ObjectReference (#PCDATA)>
<!ELEMENT xades:AllSignedDataObjects ANY>
<!ELEMENT xades:CommitmentTypeQualifiers (xades:CommitmentTypeQualifier*)>
<!ELEMENT xades:CommitmentTypeQualifier (#PCDATA %Any.ANY; )*>

<!-- End CommitmentTypeIndication -->

<!-- Start SignatureProductionPlace -->

<!ELEMENT xades:SignatureProductionPlace (xades:City?, xades:StateOrProvince?, xades:PostalCode?, 
xades:CountryName?)>
<!ELEMENT xades:City (#PCDATA)>
<!ELEMENT xades:StateOrProvince (#PCDATA)>
<!ELEMENT xades:PostalCode (#PCDATA)>
<!ELEMENT xades:CountryName (#PCDATA)>

<!-- End SignatureProductionPlace -->

<!-- Start SignerRole -->

<!ELEMENT xades:SignerRole (xades:ClaimedRoles?, xades:CertifiedRoles?)>
<!ELEMENT xades:ClaimedRoles (xades:ClaimedRole+)>
<!ELEMENT xades:CertifiedRoles (xades:CertifiedRole+)>
<!ELEMENT xades:ClaimedRole (#PCDATA %Any.ANY; )*>
<!ELEMENT xades:CertifiedRole (#PCDATA)>
<!ATTLIST xades:CertifiedRole
	Id ID #IMPLIED
	Encoding CDATA #IMPLIED
>

<!-- End SignerRole -->

<!-- Start AllDataObjectsTimeStamp, IndividualDataObjectsTimeStamp, 
SignatureTimeStamp -->

<!ELEMENT xades:AllDataObjectsTimeStamp (ds:CanonicalizationMethod?, 
(xades:EncapsulatedTimeStamp | xades:XMLTimeStamp)+)>
<!ATTLIST xades:AllDataObjectsTimeStamp
	Id ID #IMPLIED
>

<!ELEMENT xades:IndividualDataObjectsTimeStamp (xades:Include+, ds:CanonicalizationMethod?, 
(xades:EncapsulatedTimeStamp | xades:XMLTimeStamp)+)>
<!ATTLIST xades:IndividualDataObjectsTimeStamp
	Id ID #IMPLIED
>

<!ELEMENT xades:SignatureTimeStamp (ds:CanonicalizationMethod?, (xades:EncapsulatedTimeStamp 
| xades:XMLTimeStamp)+)>
<!ATTLIST xades:SignatureTimeStamp
	Id ID #IMPLIED
>

<!-- End AllDataObjectsTimeStamp, IndividualDataObjectsTimeStamp, 
SignatureTimeStamp -->

<!-- Start CompleteCertificateRefs -->

<!ELEMENT xades:CompleteCertificateRefs (xades:CertRefs)>
<!ATTLIST xades:CompleteCertificateRefs
	Id ID #IMPLIED
>
<!ELEMENT xades:CertRefs (xades:Cert+)>

<!-- End CompleteCertificateRefs -->

<!-- Start AttributeCertificateRefs -->

<!ELEMENT xades:AttributeCertificateRefs (xades:CertRefs)>
<!ATTLIST xades:AttributeCertificateRefs
	Id ID #IMPLIED
>

<!-- End AttributeCertificateRefs -->

<!-- Start CompleteRevocationRefs -->

<!ELEMENT xades:CompleteRevocationRefs (xades:CRLRefs?, xades:OCSPRefs?, xades:OtherRefs?)>
<!ATTLIST xades:CompleteRevocationRefs
	Id ID #IMPLIED
>
<!ELEMENT xades:CRLRefs (xades:CRLRef+)>
<!ELEMENT xades:OCSPRefs (xades:OCSPRef+)>
<!ELEMENT xades:OtherRefs (xades:OtherRef+)>

<!ELEMENT xades:CRLRef (xades:DigestAlgAndValue, xades:CRLIdentifier?)>
<!ELEMENT xades:OCSPRef (xades:OCSPIdentifier, xades:DigestAlgAndValue?)>
<!ELEMENT xades:OtherRef (#PCDATA %Any.ANY; )*>

<!ELEMENT xades:DigestAlgAndValue (ds:DigestMethod, ds:DigestValue)>
<!ELEMENT xades:CRLIdentifier (xades:Issuer, xades:IssueTime, xades:Number?)>
<!ATTLIST xades:CRLIdentifier
	URI CDATA #IMPLIED
>
<!ELEMENT xades:OCSPIdentifier (xades:ResponderID, xades:ProducedAt)>
<!ATTLIST xades:OCSPIdentifier
	URI CDATA #IMPLIED
>

<!ELEMENT xades:Issuer (#PCDATA)>
<!ELEMENT xades:IssueTime (#PCDATA)>
<!ELEMENT xades:Number (#PCDATA)>

<!ELEMENT xades:ResponderID (xades:ByName | xades:ByKey)>
<!ELEMENT xades:ByName  (#PCDATA)>
<!ELEMENT xades:ByKey  (#PCDATA)>
<!ELEMENT xades:ProducedAt (#PCDATA)>

<!-- End CompleteRevocationRefs -->

<!-- Start AttributeRevocationRefs -->

<!ELEMENT xades:AttributeRevocationRefs (xades:CRLRefs?, xades:OCSPRefs?, xades:OtherRefs?)>
<!ATTLIST xades:AttributeRevocationRefs
	Id ID #IMPLIED
>

<!-- End AttributeRevocationRefs -->

<!-- Start SigAndRefsTimeStamp, RefsOnlyTimeStamp  -->

<!ELEMENT xades:SigAndRefsTimeStamp (xades:Include*, ds:CanonicalizationMethod?, 
(xades:EncapsulatedTimeStamp | xades:XMLTimeStamp)+)>
<!ATTLIST xades:SigAndRefsTimeStamp
	Id ID #IMPLIED
>

<!ELEMENT xades:RefsOnlyTimeStamp (xades:Include*, ds:CanonicalizationMethod?, 
(xades:EncapsulatedTimeStamp | xades:XMLTimeStamp)+)>
<!ATTLIST xades:RefsOnlyTimeStamp
	Id ID #IMPLIED
>

<!-- End SigAndRefsTimeStamp, RefsOnlyTimeStamp  -->

<!-- Start CertificateValues -->

<!ELEMENT xades:CertificateValues (xades:EncapsulatedX509Certificate | 
xades:OtherCertificate)*>
<!ATTLIST xades:CertificateValues
	Id ID #IMPLIED
>

<!ELEMENT xades:EncapsulatedX509Certificate (#PCDATA)>
<!ATTLIST xades:EncapsulatedX509Certificate
	Id ID #IMPLIED
	Encoding CDATA #IMPLIED
>
<!ELEMENT xades:OtherCertificate (#PCDATA %Any.ANY;)*>

<!ELEMENT xades:AttrAuthoritiesCertValues (xades:EncapsulatedX509Certificate | 
xades:OtherCertificate)*>
<!ATTLIST xades:AttrAuthoritiesCertValues
	Id ID #IMPLIED
>

<!-- Start RevocationValues -->

<!ELEMENT xades:RevocationValues (xades:CRLValues?, xades:OCSPValues?, xades:OtherValues?)>
<!ATTLIST xades:RevocationValues
	Id ID #IMPLIED
>

<!ELEMENT xades:CRLValues (xades:EncapsulatedCRLValue+)>
<!ELEMENT xades:OCSPValues (xades:EncapsulatedOCSPValue+)>
<!ELEMENT xades:OtherValues (xades:OtherValue+)>

<!ELEMENT xades:EncapsulatedCRLValue (#PCDATA)>
<!ATTLIST xades:EncapsulatedCRLValue
	Id ID #IMPLIED
	Encoding CDATA #IMPLIED
>
<!ELEMENT xades:EncapsulatedOCSPValue (#PCDATA)>
<!ATTLIST xades:EncapsulatedOCSPValue
	Id ID #IMPLIED
	Encoding CDATA #IMPLIED
>
<!ELEMENT xades:OtherValue (#PCDATA %Any.ANY;  )*>

<!-- End RevocationValues -->

<!ELEMENT xades:AttributeRevocationValues (xades:CRLValues?, xades:OCSPValues?, xades:OtherValues?)>
<!ATTLIST xades:AttributeRevocationValues
	Id ID #IMPLIED
>
<!-- Start ArchiveTimeStamp -->

<!ELEMENT xades:ArchiveTimeStamp (xades:Include*, ds:CanonicalizationMethod?, 
(xades:EncapsulatedTimeStamp | xades:XMLTimeStamp)+)>
<!ATTLIST xades:ArchiveTimeStamp
	Id ID #IMPLIED
>


<!-- End ArchiveTimeStamp -->

Open in new window

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.011/InvoiceDetail.dtd">
<cXML payloadID="20110406055031" timestamp="2011-04-06T05:50:31" version="1.2.011" xml:lang="en-US" >
  <Header>
    <From>
      <Credential domain="NetworkID" >
        <Identity>1111111111</Identity>
      </Credential>
    </From>
    <To>
      <Credential domain="NetworkID" >
        <Identity>ACME TRUCKING</Identity>
      </Credential>
    </To>
  </Header>
  <Request>
    <InvoiceDetailRequest>
      <InvoiceDetailRequestHeader invoiceID="11111" purpose="standard" operation="new" invoiceDate="2011-04-05T23:59:20-07:00" >
        <InvoiceDetailHeaderIndicator/>
        <InvoiceDetailLineIndicator/>
        <InvoicePartner>
          <Contact role="soldTo" >
            <Name xml:lang="en-US" >ACME TRUCKING</Name>
            <PostalAddress>
              <Street>SUPPLY AGREEMENT</Street>
              <Street>1234 FAKE STREET</Street>
              <City>CHICAGO</City>
              <State>IL</State>
              <PostalCode>60433-1235</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
        </InvoicePartner>
        <InvoicePartner>
          <Contact role="remitTo" >
            <Name xml:lang="en-US" >JAY CUTLER</Name>
            <PostalAddress>
              <Street>Store: 1234</Street>
              <Street>555555 Headquarters Street</Street>
              <City>Chicago</City>
              <State>IL</State>
              <PostalCode>60827</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
        </InvoicePartner>
        <InvoicePartner>
          <Contact role="billTo" >
            <Name xml:lang="en" >ACME TRUCKING</Name>
            <PostalAddress>
              <Street>SUPPLY AGREEMENT</Street>
              <Street>1234 FAKE STREET</Street>
              <City>CHICAGO</City>
              <State>IL</State>
              <PostalCode>60433-1235</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
        </InvoicePartner>
        <InvoiceDetailShipping>
          <Contact role="shipTo" >
            <Name xml:lang="en" >ACME TRUCKING</Name>
            <PostalAddress>
              <Street>SUPPLY AGREEMENT</Street>
              <Street>1234 Fake street.</Street>
              <City>CHICAGO</City>
              <State>IL</State>
              <PostalCode>60629</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
          <Contact role="shipFrom" >
            <Name xml:lang="en" >Jay Cutler</Name>
            <PostalAddress>
              <Street>STORE: 1111</Street>
              <Street>5555 headquarters street</Street>
              <City>Chicago</City>
              <State>IL</State>
              <PostalCode>60827</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
        </InvoiceDetailShipping>
        <PaymentTerm payInNumberOfDays="10" ></PaymentTerm>
      </InvoiceDetailRequestHeader>
      <InvoiceDetailOrder>
        <InvoiceDetailOrderInfo>
          <OrderReference orderID="SUPPLY" orderDate="2011-04-05" ></OrderReference>
          <SupplierOrderInfo orderID="SUPPLY" ></SupplierOrderInfo>
        </InvoiceDetailOrderInfo>
        <InvoiceDetailItem invoiceLineNumber="1" quantity="3.0" >
          <UnitOfMeasure>EACH</UnitOfMeasure>
          <UnitPrice>
            <Money currency="USD" >0.31</Money>
          </UnitPrice>
          <InvoiceDetailItemReference lineNumber="1" >
            <ItemID>
              <SupplierPartID>11111</SupplierPartID>
            </ItemID>
            <Description xml:lang="EN" >TEST - SW 3 1/4 X</Description>
          </InvoiceDetailItemReference>
        </InvoiceDetailItem>
        <InvoiceDetailItem invoiceLineNumber="2" quantity="3.0" >
          <UnitOfMeasure>EACH</UnitOfMeasure>
          <UnitPrice>
            <Money currency="USD" >28.49</Money>
          </UnitPrice>
          <InvoiceDetailItemReference lineNumber="2" >
            <ItemID>
              <SupplierPartID>12345</SupplierPartID>
            </ItemID>
            <Description xml:lang="EN" >TEST - METAL GLAZE,</Description>
          </InvoiceDetailItemReference>
        </InvoiceDetailItem>
        <InvoiceDetailItem invoiceLineNumber="3" quantity="9.0" >
          <UnitOfMeasure>EACH</UnitOfMeasure>
          <UnitPrice>
            <Money currency="USD" >4.68</Money>
          </UnitPrice>
          <InvoiceDetailItemReference lineNumber="3" >
            <ItemID>
              <SupplierPartID>1234</SupplierPartID>
            </ItemID>
            <Description xml:lang="EN" ><![CDATA[JOHN-1-1/2" MASK]]></Description>
          </InvoiceDetailItemReference>
        </InvoiceDetailItem>
      </InvoiceDetailOrder>
      <InvoiceDetailSummary>
        <SubtotalAmount>
          <Money currency="USD" >128.52</Money>
        </SubtotalAmount>
        <Tax>
          <Money currency="USD" >4.09</Money>
          <Description xml:lang="EN" >Standard</Description>
          <TaxDetail category="Sales Tax" purpose="tax" >
            <TaxAmount>
              <Money currency="USD" >4.09</Money>
            </TaxAmount>
          </TaxDetail>
        </Tax>
        <InvoiceDetailDiscount>
          <Money currency="USD" >0.00</Money>
        </InvoiceDetailDiscount>
        <NetAmount>
          <Money currency="USD" >132.61</Money>
        </NetAmount>
        <DueAmount>
          <Money currency="USD" >132.61</Money>
        </DueAmount>
      </InvoiceDetailSummary>
    </InvoiceDetailRequest>
  </Request>
</cXML>

Open in new window

0
fdorazio
Asked:
fdorazio
  • 10
  • 7
1 Solution
 
Anthony PerkinsCommented:
What values do you want to retrieve from the Xml document?
0
 
fdorazioAuthor Commented:
I need to extract all of the values.
0
 
Anthony PerkinsCommented:
I see. Please post the schema for your table?
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
Anthony PerkinsCommented:
And also how do the values in the Xml nodes map to the columns in the table (if it is not obvious that is)
0
 
fdorazioAuthor Commented:
The table structure is listed below. Should have the same names as the cXML doc fields or close too the cXML fields.

CREATE TABLE [dbo].[SWdata](
      [payloadid] ,[timestamp] ,[version] ,[lang] ,[domain] ,[identity] ,[domain2] ,[identity3] ,[invoiceid] ,[purpose] ,[operation] ,
      [invoicedate] ,[invoicedetailheaderindicator] ,[invoicedetaillineindicator] ,[role] ,[name] ,[lang4] ,[street] ,[city] ,[state] ,[postalcode] ,
      [country] ,[isocountrycode] ,[role5] ,[name6] ,[lang7] ,[street8] ,[city9] ,[state10] ,[postalcode11] ,[country12] ,[isocountrycode13] ,[payinnumberofdays] ,[orderid] ,
      [orderdate] ,[orderID14] ,[invoicelinenumber] ,[quantity] ,[Unitofmeasure] ,[money] ,[currency] ,[linenumber] ,
      [supplierpartid] ,[description] ,[lang15] ,[money16] ,[currency17] ,[money18] ,[currency19] ,[description20] ,[lang21] ,[category] ,[purpose22] ,
      [money23] ,[currency24] ,[money25] ,[currency26] ,[money27] ,[currency28] ,[money29] ,
      [currency30]
0
 
Anthony PerkinsCommented:
You would do it something like this:
DECLARE	@idoc integer,
	@Xml AS varchar(8000)

SET @Xml =
'<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.011/InvoiceDetail.dtd">
<cXML payloadID="20110406055031" timestamp="2011-04-06T05:50:31" version="1.2.011" xml:lang="en-US" >
  <Header>
    <From>
      <Credential domain="NetworkID" >
        <Identity>1111111111</Identity>
      </Credential>
    </From>
    <To>
      <Credential domain="NetworkID" >
        <Identity>ACME TRUCKING</Identity>
      </Credential>
    </To>
  </Header>
  <Request>
    <InvoiceDetailRequest>
      <InvoiceDetailRequestHeader invoiceID="11111" purpose="standard" operation="new" invoiceDate="2011-04-05T23:59:20-07:00" >
        <InvoiceDetailHeaderIndicator/>
        <InvoiceDetailLineIndicator/>
        <InvoicePartner>
          <Contact role="soldTo" >
            <Name xml:lang="en-US" >ACME TRUCKING</Name>
            <PostalAddress>
              <Street>SUPPLY AGREEMENT</Street>
              <Street>1234 FAKE STREET</Street>
              <City>CHICAGO</City>
              <State>IL</State>
              <PostalCode>60433-1235</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
        </InvoicePartner>
        <InvoicePartner>
          <Contact role="remitTo" >
            <Name xml:lang="en-US" >JAY CUTLER</Name>
            <PostalAddress>
              <Street>Store: 1234</Street>
              <Street>555555 Headquarters Street</Street>
              <City>Chicago</City>
              <State>IL</State>
              <PostalCode>60827</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
        </InvoicePartner>
        <InvoicePartner>
          <Contact role="billTo" >
            <Name xml:lang="en" >ACME TRUCKING</Name>
            <PostalAddress>
              <Street>SUPPLY AGREEMENT</Street>
              <Street>1234 FAKE STREET</Street>
              <City>CHICAGO</City>
              <State>IL</State>
              <PostalCode>60433-1235</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
        </InvoicePartner>
        <InvoiceDetailShipping>
          <Contact role="shipTo" >
            <Name xml:lang="en" >ACME TRUCKING</Name>
            <PostalAddress>
              <Street>SUPPLY AGREEMENT</Street>
              <Street>1234 Fake street.</Street>
              <City>CHICAGO</City>
              <State>IL</State>
              <PostalCode>60629</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
          <Contact role="shipFrom" >
            <Name xml:lang="en" >Jay Cutler</Name>
            <PostalAddress>
              <Street>STORE: 1111</Street>
              <Street>5555 headquarters street</Street>
              <City>Chicago</City>
              <State>IL</State>
              <PostalCode>60827</PostalCode>
              <Country isoCountryCode="US" >United States</Country>
            </PostalAddress>
          </Contact>
        </InvoiceDetailShipping>
        <PaymentTerm payInNumberOfDays="10" ></PaymentTerm>
      </InvoiceDetailRequestHeader>
      <InvoiceDetailOrder>
        <InvoiceDetailOrderInfo>
          <OrderReference orderID="SUPPLY" orderDate="2011-04-05" ></OrderReference>
          <SupplierOrderInfo orderID="SUPPLY" ></SupplierOrderInfo>
        </InvoiceDetailOrderInfo>
        <InvoiceDetailItem invoiceLineNumber="1" quantity="3.0" >
          <UnitOfMeasure>EACH</UnitOfMeasure>
          <UnitPrice>
            <Money currency="USD" >0.31</Money>
          </UnitPrice>
          <InvoiceDetailItemReference lineNumber="1" >
            <ItemID>
              <SupplierPartID>11111</SupplierPartID>
            </ItemID>
            <Description xml:lang="EN" >TEST - SW 3 1/4 X</Description>
          </InvoiceDetailItemReference>
        </InvoiceDetailItem>
        <InvoiceDetailItem invoiceLineNumber="2" quantity="3.0" >
          <UnitOfMeasure>EACH</UnitOfMeasure>
          <UnitPrice>
            <Money currency="USD" >28.49</Money>
          </UnitPrice>
          <InvoiceDetailItemReference lineNumber="2" >
            <ItemID>
              <SupplierPartID>12345</SupplierPartID>
            </ItemID>
            <Description xml:lang="EN" >TEST - METAL GLAZE,</Description>
          </InvoiceDetailItemReference>
        </InvoiceDetailItem>
        <InvoiceDetailItem invoiceLineNumber="3" quantity="9.0" >
          <UnitOfMeasure>EACH</UnitOfMeasure>
          <UnitPrice>
            <Money currency="USD" >4.68</Money>
          </UnitPrice>
          <InvoiceDetailItemReference lineNumber="3" >
            <ItemID>
              <SupplierPartID>1234</SupplierPartID>
            </ItemID>
            <Description xml:lang="EN" ><![CDATA[JOHN-1-1/2" MASK]]></Description>
          </InvoiceDetailItemReference>
        </InvoiceDetailItem>
      </InvoiceDetailOrder>
      <InvoiceDetailSummary>
        <SubtotalAmount>
          <Money currency="USD" >128.52</Money>
        </SubtotalAmount>
        <Tax>
          <Money currency="USD" >4.09</Money>
          <Description xml:lang="EN" >Standard</Description>
          <TaxDetail category="Sales Tax" purpose="tax" >
            <TaxAmount>
              <Money currency="USD" >4.09</Money>
            </TaxAmount>
          </TaxDetail>
        </Tax>
        <InvoiceDetailDiscount>
          <Money currency="USD" >0.00</Money>
        </InvoiceDetailDiscount>
        <NetAmount>
          <Money currency="USD" >132.61</Money>
        </NetAmount>
        <DueAmount>
          <Money currency="USD" >132.61</Money>
        </DueAmount>
      </InvoiceDetailSummary>
    </InvoiceDetailRequest>
  </Request>
</cXML>'

EXEC sp_xml_preparedocument @idoc OUTPUT, @Xml

SELECT	payloadID,
	[timestamp],
	[version],
	lang,
	[domain],
	[Identity],
	[domain2],
	[Identity3]
-- Rest of the columns go here		
FROM    OPENXML (@idoc, 'cXML', 8) WITH (
	payloadID bigint '@payloadID',
	[timestamp] datetime '@timestamp',
	[version] varchar(10) '@version',
	lang varchar(10) '@xml:lang',
	domain varchar(20) 'Header/From/Credential/@domain',
	[Identity] varchar(20) 'Header/From/Credential/Identity',
	domain2 varchar(20) 'Header/To/Credential/@domain',
	[Identity3] varchar(20) 'Header/To/Credential/Identity'
-- Rest of the XPath queries go here
	)

EXEC sp_xml_removedocument @idoc

Open in new window

0
 
fdorazioAuthor Commented:
What if the string cXML string is longer than the 8000?
0
 
Anthony PerkinsCommented:
>>What if the string cXML string is longer than the 8000? <<
That was just an example.  Since you are using SQL Server 2000 you would pass in your Xml as a text data type.
0
 
fdorazioAuthor Commented:
Can you provide an example? I thought you could not use text data type as a local variable.
0
 
Anthony PerkinsCommented:
>>I thought you could not use text data type as a local variable. <<
I did not say use text as a local variable.  I said you would pass the Xml as a parameter to a Stored Procedure as a text data type.   Do you need help with that?
0
 
Anthony PerkinsCommented:
In other words, you can and should use a Stored Procedure to pass in the Xml document as a parameter with a text data type.
0
 
fdorazioAuthor Commented:
Got it thanks. I am only getting one row as a result. Should'nt I be getting at least 3 because of the <InvoiceDetailItem invoiceLineNumber="3" node?
0
 
Anthony PerkinsCommented:
>>Should'nt I be getting at least 3 because of the <InvoiceDetailItem invoiceLineNumber="3" node? <<
Yes.  If you need the InvoiceDetailItem than you will need to modify the XPath.
0
 
Anthony PerkinsCommented:
As in:
EXEC sp_xml_preparedocument @idoc OUTPUT, @Xml

SELECT	payloadID,
	[timestamp],
	[version],
	lang,
	[domain],
	[Identity],
	domain2,

	invoiceLineNumber,
	quantity
FROM    OPENXML (@idoc, 'cXML/Request/InvoiceDetailRequest/InvoiceDetailOrder/InvoiceDetailItem', 8) WITH (
	payloadID bigint '../../../../@payloadID',
	[timestamp] datetime '../../../../@timestamp',
	[version] varchar(10) '../../../../@version',
	lang varchar(10) '../../../../@xml:lang',
	domain varchar(20) '../../../../Header/From/Credential/@domain',
	[Identity] varchar(20) '../../../../Header/From/Credential/Identity',
	domain2 varchar(20) '../../../../Header/To/Credential/@domain',
	Identity3 varchar(20) '../../../../Header/To/Credential/Identity',
		
	invoiceLineNumber integer '@invoiceLineNumber',
	quantity numeric(18, 4) '@quantity'
	)

EXEC sp_xml_removedocument @idoc

Open in new window

0
 
fdorazioAuthor Commented:
I have split this into 3 tables but I get only null values after the identity columns. What am I doing wrong? See the Code Below.


--INVOICE CONTACTS
EXEC sp_xml_preparedocument @idoc OUTPUT, @Xml

SELECT      payloadID,[timestamp],[version],lang,[domain],[Identity],domain2,
role,[name],[name2],[street],
[street2],[city],[state],[postalcode],[country]  
            
FROM    OPENXML (@idoc, 'cXML/Request/InvoiceDetailRequest/InvoiceDetailRequestHeader/InvoicePartner/Contact', 8) WITH (
      payloadID bigint '../../../../../@payloadID',
      [timestamp] datetime '../../../../../@timestamp',
      [version] varchar(10) '../../../../../@version',
      lang varchar(10) '../../../../../@xml:lang',
      domain varchar(20) '../../../../../Header/From/Credential/@domain',
      [Identity] varchar(20) '../../../../../Header/From/Credential/Identity',
      domain2 varchar(20) '../../../../../Header/To/Credential/@domain',
      Identity3 varchar(20) '../../../../../Header/To/Credential/Identity',
      role varchar(20) '/Role',
      [name] varchar(200) '/Name/@xml:lang',
    [name2] varchar(200) '/Name',
      [street] varchar(200) '/Street',
      [street2] varchar(200) '/Street' ,
    [city] varchar(200) '/City',
      [state] varchar(200) '/State',
      [postalcode]varchar(200) '/PostalCode',
      [country] varchar(200) '/Country'
            
)
EXEC sp_xml_removedocument @idoc


--INVOICE DETAILS
EXEC sp_xml_preparedocument @idoc OUTPUT, @Xml

SELECT      payloadID,[timestamp],[version],lang,[domain],[Identity],
      domain2,invoiceLineNumber,quantity,UnitofMeasure,[Money],[linenumber],[SupplierPartID],[Description]
FROM    OPENXML (@idoc, 'cXML/Request/InvoiceDetailRequest/InvoiceDetailOrder/InvoiceDetailItem', 8) WITH (
      payloadID bigint '../../../../@payloadID',
      [timestamp] datetime '../../../../@timestamp',
      [version] varchar(10) '../../../../@version',
      lang varchar(10) '../../../../@xml:lang',
      domain varchar(20) '../../../../Header/From/Credential/@domain',
      [Identity] varchar(20) '../../../../Header/From/Credential/Identity',
      domain2 varchar(20) '../../../../Header/To/Credential/@domain',
      Identity3 varchar(20) '../../../../Header/To/Credential/Identity',
      invoiceLineNumber integer '@invoiceLineNumber',
      quantity numeric(18, 4) '@quantity',
      UnitofMeasure varchar(20) '/UnitOfMeasure',
      [Money] varchar(20) '/UnitPrice/@Money',
linenumber varchar(20) '/InvoiceDetailItemReference/@linenumber',
SupplierPartID varchar(20) '/InvoiceDetailItemReference/ItemID/SupplierPartID',
Description varchar(20) '/InvoiceDetailItemReference/Description')
EXEC sp_xml_removedocument @idoc

--INVOICE SUMMARY

EXEC sp_xml_preparedocument @idoc OUTPUT, @Xml

SELECT      payloadID,[timestamp],
      [version],lang,[domain],[Identity],domain2,
      [Subtotal],
      [Tax] ,
      [Description],
      [Category] ,
      [purpose] ,
      [TaxAmount],
    [DetailDiscount],
      [NetAmount],
      [DueAmount]

FROM    OPENXML (@idoc, 'cXML/Request/InvoiceDetailRequest/InvoiceDetailSummary', 8) WITH (
      payloadID bigint '../../../@payloadID',
      [timestamp] datetime '../../../@timestamp',
      [version] varchar(10) '../../../@version',
      lang varchar(10) '../../../@xml:lang',
      domain varchar(20) '../../../Header/From/Credential/@domain',
      [Identity] varchar(20) '../../../Header/From/Credential/Identity',
      domain2 varchar(20) '../../../Header/To/Credential/@domain',
      Identity3 varchar(20) '../../../Header/To/Credential/Identity',
            
      [Subtotal] varchar(20) '/SubtotalAmount/Money/Currency',
      [Tax] varchar(20) '/Tax/Money/Currency',
      [Description] varchar(20) '/Tax/Description',
      [Category] varchar(20) '/Tax/TaxDetail/@category',
      [purpose] varchar(20) '/Tax/TaxDetail/@purpose',
      [TaxAmount] varchar(20) '/TaxDetail/TaxAmount/Money',
    [DetailDiscount] varchar(20) '/InvoiceDetailDiscount/Money',
      [NetAmount] varchar(20) '/NetAmount/Money',
      [DueAmount] varchar(20) '/DueAmount/Money'
)
EXEC sp_xml_removedocument @idoc
0
 
Anthony PerkinsCommented:
Do it this way:
SELECT	payloadID,
	[timestamp],
	[version],
	lang,
	[domain],
	[Identity],
	domain2,
	[role],
	[name],
	[name2],
	[street],
	[street2],
	[city],
	[state],
	[postalcode],
	[country]
FROM	OPENXML (@idoc, 'cXML/Request/InvoiceDetailRequest/InvoiceDetailRequestHeader/InvoicePartner/Contact', 8) WITH (
	payloadID bigint '../../../../../@payloadID',
	[timestamp] datetime '../../../../../@timestamp',
	[version] varchar(10) '../../../../../@version',
	lang varchar(10) '../../../../../@xml:lang',
	domain varchar(20) '../../../../../Header/From/Credential/@domain',
	[Identity] varchar(20) '../../../../../Header/From/Credential/Identity',
	domain2 varchar(20) '../../../../../Header/To/Credential/@domain',
	Identity3 varchar(20) '../../../../../Header/To/Credential/Identity',
	[role] varchar(20) '@role',
	[name] varchar(200) 'Name/@xml:lang', 
	[name2] varchar(200) 'Name', 
	[street] varchar(200) 'PostalAddress/Street', 
	[street2] varchar(200) 'PostalAddress/Street' ,
	[city] varchar(200) 'PostalAddress/City', 
	[state] varchar(200) 'PostalAddress/State', 
	[postalcode]varchar(200) 'PostalAddress/PostalCode', 
	[country] varchar(200) 'PostalAddress/Country' 
	)

SELECT	payloadID,
	[timestamp],
	[version],
	lang,
	[domain],
	[Identity],
	domain2,
	invoiceLineNumber,
	quantity,
	UnitofMeasure,
	[Money],
	[linenumber],
	[SupplierPartID],
	[Description]
FROM	OPENXML (@idoc, 'cXML/Request/InvoiceDetailRequest/InvoiceDetailOrder/InvoiceDetailItem', 8) WITH (
	payloadID bigint '../../../../@payloadID',
	[timestamp] datetime '../../../../@timestamp',
	[version] varchar(10) '../../../../@version',
	lang varchar(10) '../../../../@xml:lang',
	domain varchar(20) '../../../../Header/From/Credential/@domain',
	[Identity] varchar(20) '../../../../Header/From/Credential/Identity',
	domain2 varchar(20) '../../../../Header/To/Credential/@domain',
	Identity3 varchar(20) '../../../../Header/To/Credential/Identity',
	invoiceLineNumber integer '@invoiceLineNumber',
	quantity numeric(18, 4) '@quantity',
	UnitofMeasure varchar(20) 'UnitOfMeasure',
	[Money] varchar(20) 'UnitPrice/Money',
	linenumber varchar(20) 'InvoiceDetailItemReference/@lineNumber',
	SupplierPartID varchar(20) 'InvoiceDetailItemReference/ItemID/SupplierPartID',
	[Description] varchar(20) 'InvoiceDetailItemReference/Description'
	)

SELECT	payloadID,
	[timestamp],
	[version],lang,
	[domain],
	[Identity],
	domain2,
	[Subtotal],
	[Tax],
	[Description],
	[Category] ,
	[purpose] ,
	[TaxAmount],
	[DetailDiscount],
	[NetAmount],
	[DueAmount] 
FROM	OPENXML (@idoc, 'cXML/Request/InvoiceDetailRequest/InvoiceDetailSummary', 8) WITH (
	payloadID bigint '../../../@payloadID',
	[timestamp] datetime '../../../@timestamp',
	[version] varchar(10) '../../../@version',
	lang varchar(10) '../../../@xml:lang',
	domain varchar(20) '../../../Header/From/Credential/@domain',
	[Identity] varchar(20) '../../../Header/From/Credential/Identity',
	domain2 varchar(20) '../../../Header/To/Credential/@domain',
	Identity3 varchar(20) '../../../Header/To/Credential/Identity',
    
	[Subtotal] varchar(20) 'SubtotalAmount',
	[Tax] varchar(20) 'Tax',
	[Description] varchar(20) 'Tax/Description',
	[Category] varchar(20) 'Tax/TaxDetail/@category',
	[purpose] varchar(20) 'Tax/TaxDetail/@purpose',
	[TaxAmount] varchar(20) 'Tax/TaxDetail/TaxAmount',
	[DetailDiscount] varchar(20) 'InvoiceDetailDiscount/Money',
	[NetAmount] varchar(20) 'NetAmount/Money',
	[DueAmount] varchar(20) 'DueAmount/Money'
	)

EXEC sp_xml_removedocument @idoc

Open in new window

0
 
fdorazioAuthor Commented:
Great Job! and Quick To! Thanks!!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 10
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now