[This local archive copy is from the official and canonical URL, http://www.receipt.org/dridtd.htm, 1999-01-19; please refer to the canonical source document if possible.]


Digital Receipt
Annotated
XML Data Type Definition

Kent M. Davidson
Differential, Inc.

kent@differential.com

Revision 0.9

This document is a work in progress of the Digital Receipt DTD specification, and is subject to change.
Feedback is welcome by e-mailing the above address.

This document may be distributed freely provided it is not altered or modified in any way.


Table of Contents


Specification top

Guide

This DTD specification contains labeled sections which contains information about the various elements in the DTD:

XML:

The raw XML text which appears in the DTD

Use:

How this particular Element should be used within an XML document, and the intention of the data within the element.

Parents:

The other elements which may include this element

Children:

The child elements which may be included within this element

Attributes:

Contains a chart in the format:
Name Type Description
The attribute name The attribute type A description of valid values and use of this attribute in the DRI document.

Notes:

Any special notes when creating or generating this element

Example:

An example use of this element in context.


XML Header


XML:

<?xml version="1.0" encoding="US-ASCII"?>
<!-- Document Type Definition for Generic Digital Receipts -->

Use:

A well-formed XML DTD document must begin with the version of XML it is implemented using, as well as the default encoding of the document. The XML header must include at least this information in order for compatible XML parsers to be able to ready this DTD.

Parents:

No parents.

Children:

No children.

Attributes:

Name Type Description
version CDATA The XML specification version is currently "1.0". The DRI DTD is supported in XML 1.0 currently.
encoding CDATA The DRI DTD may be encoded in any recommended encoding. For simplicity, this version uses the US-ASCII encoding.

Notes:

See the XML specification.


receipt Element


XML:

<!ELEMENT receipt (raw_receipt, signature+)>
    <!ATTLIST receipt 
        version         CDATA               #REQUIRED
        type            CDATA               #REQUIRED
        unique_id       ID                  #REQUIRED
    >

Use:

The receipt element is the master container for a digital receipt. It contains a single raw_receipt, and at least one signature. A digital receipt, while in transit, may accumulate multiple signatures depending on the workflow the number of parties who validate the accuracy of a receipt.

Parents:

No parents.

Children:

raw_receipt
signature

Attributes:

Name Type Description
version CDATA  A string containing the current version of the receipt format. For this release, the string "0.9", for the final release of the Digital Receipt specification, the string "1.0".
type CDATA A string indicating the type of receipt, for display to the user.
unique_id ID The Universally Unique ID for this receipt.

Notes:

A single entity of a Digital Receipt contains a single <receipt>...</receipt> element.

Example:

See Example section.


raw_receipt Element


XML:

<!ELEMENT raw_receipt 
    (   issuer,
        recipients+,
        issue_date,
        first_signing_date,
        primary_content,
        related_receipts*
    )
> 

Use:

The raw_receipt element is the core of a receipt itself . Each signature of a receipt actually signs aspects of the raw_receipt data as the content being signed. The raw_receipt element in a receipt contains the issuing entity, one or more recipients, the date of issue, the first signature date, and a list of zero or more related receipt IDs.

Parents:

receipt

Children:

issuer
recipients
issue_date
first_signing_date
primary_content
related_receipts

Attributes:

None.

Notes:

None.

Example:

See Example section.


issuer Element


XML:

 <!ELEMENT issuer (entity)>

Use:

The issuer element is a container which labels the entity which actually issued the receipt originally. A single issuer exists for a receipt. The original generator of a receipt should fill in the issuer entity as itself.

Parents:

raw_receipt

Children:

entity

Attributes:

None.

Notes:

None.

Example:

<issuer>
<entity
id = "283018246192387"
printed_name = "Aiden the Auditor"
logoURL = "http://www.auditor-service.com/images/logo.gif">
</entity>
</issuer>


recipients Element


XML:

<!ELEMENT recipients (entity+)>

Use:

The recipients element is a container for one or more recipients entites. When a receipt is originally issued, the parties that the original issuer relays the receipt to should fill in the recipients section before signing the receipt.

Parents:

raw_receipt

Children:

entity

Attributes:

None.

Notes:

None.

Example:

<recipients>
<entity
id = "283018246192387"
printed_name = "Aiden the Auditor"
logoURL = "http://www.auditor-service.com/images/logo.gif">
</entity>
</recipients>


issue_date Element

XML:

<!ELEMENT issue_date (date)>

Use:

The issue_date element is a container for a date element. The issue date is the original date of issue of a receipt by the issuer.

Parents:

raw_receipt

Children:

date

Attributes:

None.

Notes:

None.

Example:

<issue_date>
    <date
        year    = "1998"
        month   = "10"
        day     = "2"
        hour    = "22"
        minute  = "45"
        second  = "31">
    </date>
</issue_date>


first_signing_date Element

XML:

<!ELEMENT first_signing_date (date)>

Use:

 The first_signing_date element is a container for a date element. The first signing date is the original date of signing by any party.

Parents:

raw_receipt

Children:

date

Attributes:

None.

Notes:

None.

Example:

<first_signing_date>
    <date
        year    = "1998"
        month   = "10"
        day     = "2"
        hour    = "22"
        minute  = "45"
        second  = "31">
    </date>
</first_signing_date>


primary_content Element

XML:

<!ELEMENT primary_content(description,primary_document)>
    <!ATTLIST primary_content
        id              CDATA               #REQUIRED
        type            CDATA               #IMPLIED
        status          CDATA               #IMPLIED
    >

Use:

The primary_content element serves as the container for the actual receipt data.

Parents:

raw_receipt

Children:

description
primary_document

Attributes:

Name Type Description
id CDATA The ID of the primary content, as assigned by the issuer.
type CDATA A string indicating the type of information stored within the content.
status CDATA An application-defined string indicating the current status of the content, whether it is encrypted or plain-text, etc.

Notes:

None.

Example:

 


description Element

XML:

<!ELEMENT description (#PCDATA)>

Use:

The description element delimits a string which outlines a description of the containing element. The description is not meant to be parsed, but instead must be displayed to the user through some form of user interface.

Parents:

primary_content

Children:

None.

Attributes:

None.

Notes:

CHANGE: Include international languages in specification

Example:

<description>
Document transferred by Extranet Courier service
<\description>


primary_document Element

XML:

<!ELEMENT primary_document ANY>

Use:

The intention of the primary_document element is to allow developers to create their own document types which can extend the receipt basic DTD type. The example section shows how this can be done.

Parents:

primary_content

Children:

User-defined.

Attributes:

None.

Notes:

None.

Example:

<primary_document>
Traded 100 Shares ORCL via e-Trade
</primary_document>


related_receipts Element

XML:

<!ELEMENT related_receipts EMPTY>
    <!ATTLIST related_receipts
        id              ID                  #REQUIRED
        relationship    CDATA               #REQUIRED
    >

Use:

A receipt may contain zero or more related_receipts elements. Receipts which are coordinated and represent some form of workflow should be connected via the unique ID of the related receipts and the relationship.

Parents:

raw_receipt

Children:

None.

Attributes:

Name Type Description
id CDATA The ID of the related receipt
relationship CDATA A string indicating the relationship if this receipt with the related receipt.

Notes:

CHANGE: Update relationship to be standardized enumerated type.

Example:

 


signature Element

XML:

<!ELEMENT signature (signing_date+)>
    <!ATTLIST signature
        sigid           CDATA               #REQUIRED
        comment         CDATA               #REQUIRED
        algorithm       CDATA               #REQUIRED
        signature       CDATA               #REQUIRED
        signor_id       CDATA               #REQUIRED
        key_id          CDATA               #REQUIRED
        certificate     CDATA               #IMPLIED
    >

Use:

The signature element is the core of the digital receipt which signs the content and provides the legal verifiability of the receipt document, as well as providing linkages to the X.509 certificates which orignated the signatures.

Parents:

receipt

Children:

signing_date

Attributes:

Name Type Description
sigid CDATA The signature ID of the signing party
comment CDATA An application defined constant.
algorithm CDATA Currently the only valid value is SHA1withDSA, as other algorithms become available, they will be added.
signature CDATA The base-64 encoded signature of the algorithm-generated digest of the primary_document, signed by the key corresponding to the signor_id, below.
signer_id CDATA The Signer ID is a pointer to the X.509 certificate which actually signed the document. Client name of the X.509 certificate, which may be used to retrieve the certificate itself, from either a LDAP database or a Java key store.
key_id CDATA The Key ID is used to retrieve the key itself. Client name of the X.509 certificate, which may be used to retrieve the certificate itself, from either a LDAP database or a Java key store.
certificate CDATA Base-64 encoded X.509 certificate. This is similar to PEM encoding of certificates.

Notes:

None.

Example:

<signature
sigid = "AUTH::20:01:01:01:64::2"
comment = "sign 2"
algorithm = "SHA1withDSA"
signor_id = "AUTH::20:01:01:01:64"
key_id = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyjxUoaZLEtDUcs+X6"
"HCi6fkcsfo2gjQwOfhETSCeV/deJb4r4MGvZxMMxyO+cSuGaVEEhXiXT"
"lz5lQPKpqNsIwimKKK1UC7gmklJPScbWl/VvnkHlHbYtDLocj2sxxMYR"
"orPlhMcxG2y8jx9dtXKGuscjk6S3A2ei0Egy2iyXIwIDAQAB"
transaction = "true"
signature = "go8ZbiNmwI1bxGuW+Z4fyCVNU0IFbitfjGCBhM5rm2I9ffW6eaKNDeyic"
"X//4FFsf6tCvpR+ZMTCkh8v8lH/62JK69yxHStnfqtYwN4NWcJkBK18RC"
"DQGIEK35c2+XR93QVn875GwQr+eORxdE9a6ym4aFgdJ4xmllr5fbkoHoM="
>


entity Element

XML:

<!ELEMENT entity EMPTY>
    <!ATTLIST entity
        id              CDATA               #REQUIRED
        printed_name    CDATA               #IMPLIED
        logoURL         CDATA               #IMPLIED
    >

Use:

An entity represents a member involved in a transaction.

Parents:

issuer
recipients

Children:

None.

Attributes:

Name Type Description
id CDATA The Universally Unique ID associated with an entity.
printed_name CDATA The user-readable name of this entity
logoURL CDATA A ftp, http, or https URL pointing to the logo for this entity.

Notes:

None.

Example:

<entity
id = "283018246192387"
printed_name = "Aiden the Auditor"
logoURL = "http://www.auditor-service.com/images/logo.gif">
</entity>


signing_date Element

XML:

<!ELEMENT signing_date (date)>

Use:

The signing date element is a container for the date element, and indicates when a signature on a receipt was executed.

Parents:

signature

Children:

date

Attributes:

None.

Notes:

None.

Example:

<signing_date>
  <date
    year="1998"
    month="8"
    day="22">
  </date>
</signing_date>


date Element

XML:

<!ELEMENT date EMPTY>
    <!ATTLIST date
        year            CDATA               #REQUIRED
        month           CDATA               #REQUIRED
        day             CDATA               #REQUIRED
        hour            CDATA               #IMPLIED
        minute          CDATA               #IMPLIED
        second          CDATA               #IMPLIED
    >

Use:

Just like any legal document, a digital receipt requires at least the day, month, and year in a date format. Hours, minutes, and seconds are optional. Dates are used to stamp the time on receipt to indicate when particular actions were taken.

Parents:

first_signing_date
issue_date
signing_date

Children:

None.

Attributes:

Name Type Description
year CDATA A four-digit year, e.g. "1999", "2003". Two-digit year abbreviations are invalid,
month CDATA A number in the range of 1 to 12. 1 is January, 2 is February, etc.
day CDATA A valid day within the month specified, in the range of 1 to 31.
hour CDATA A number specified in military time
minute CDATA A number in the range of 0 to 59, indicating the number of minutes past the hour.
second CDATA A number in the range of 0 to 59, indicating the number of seconds past the minute.

Notes:

All dates are specified in GMT.

CHANGE: Support alternate time zones.

CHANGE: There will be a potential change in this spec to support a standardized date format. Also, definition will be expanded to include trusted time specification.

Example:

<date 
    year="1999"
    month="1"
    day="18"
    hour="10"
    minute="32"
    second="44">
</date>


Examples top

User-defined Receipt DTD

<!DOCTYPE receipt SYSTEM "dri.dtd" [
    
    <!-- Override the default primary document definition -->

    <!ELEMENT primary_document (InsuranceRequest | InsuranceResponse)>

    <!ELEMENT InsuranceRequest (InsurablePurchase)>
        <!ATTLIST InsuranceRequest 
            RequestId       CDATA       #REQUIRED
            AmountRequested CDATA       #REQUIRED
        >
    
    <!ELEMENT InsurablePurchase
        (   Supplier, 
            Manufacturer, 
            PurchaseItem
        )
    >

    <!ELEMENT Supplier EMPTY>
        <!ATTLIST Supplier
            Name            CDATA       #REQUIRED
            Id              CDATA       #REQUIRED
        >

    <!ELEMENT Manufacturer EMPTY>
        <!ATTLIST Manufacturer
            Name            CDATA       #REQUIRED
            Id              CDATA       #REQUIRED
        >

    <!ELEMENT PurchaseItem EMPTY>
        <!ATTLIST PurchaseItem 
            ProductCode     CDATA       #REQUIRED>
            ProductName     CDATA       #REQUIRED>
            ProductPrice    CDATA       #REQUIRED>
            Quantity        CDATA       #REQUIRED>
            Amount          CDATA       #REQUIRED>
    
    <!ELEMENT InsuranceResponse (InsuranceDenial | InsuranceApproval)>
    
    <!ELEMENT InsuranceDenial (Insurable)>
        <!ATTLIST InsuranceDenial
            RequestId       CDATA       #REQUIRED
            Reason          CDATA       #REQUIRED
        >
        
    <!ELEMENT InsuranceApproval (InsuranceAmount, Insurable)>
        <!ATTLIST InsuranceApproval
            RequestId       CDATA       #REQUIRED
            Reason          CDATA       #REQUIRED
        >
]>

User-defined Receipt XML

<?xml version = "1.0"?>
<!DOCTYPE receipt SYSTEM "insurance.dtd">
<receipt 
    version     = "1.000"
    type        = "insurance request"
    unique_id   = "AUTH::20:01:01:01:64::000111">
    <raw_receipt>
        <issuer>
            <entity
                id              = "283018246192387"
                printed_name    = "Aiden the Auditor"
                logoURL         = "http://www.auditor-service.com/images/logo.gif">
            </entity>
        </issuer>
        <recipients>
            <entity
                id              = "8287493634920367"
                printed_name    = "Maya Manufacturing"
                logoURL         = "ftp://ftp.maya.com/pub/maya.GIF">
            </entity>
        </recipients>
        <recipients>
            <entity  
                id              = "8287493634920367"
                printed_name    = "Global Industries Notary"
                logoURL         = "http://www.global.com/logo.GIF">
            </entity>
        </recipients>
        <issue_date>
            <date
                year    = "1998"
                month   = "10"
                day     = "2"
                hour    = "22"
                minute  = "43"
                second  = "14">
            </date>
        </issue_date>
        <first_signing_date>
            <date
                year    = "1998"
                month   = "10"
                day     = "2"
                hour    = "22"
                minute  = "43"
                second  = "14">
            </date>
        </first_signing_date>
        <related_receipts
            id              = "AUTH::20:01:01:01:64::000105"
            relationship    = "57876568">
        </related_receipts>
        <related_receipts
            id              = "AUTH::20:01:01:01:64::000103"
            relationship    = "57876568">
        </related_receipts>
        <primary_data>
            <description>
                Insurance request for insurable purchase.
            </description>
            <primary_document>
                <!-- The content of the receipt-->
            
                <InsuranceRequest
                    RequestId       = "13927"
                    AmountRequested = "5000000">
                    <InsurablePurchase>
                        <Supplier
                            Name        = "TP2"
                            Id          = "S1234">
                        </Supplier>
                        <Manufacturer
                            Name        = "MF1"
                            Id          = "M4567">
                        </Manufacturer>
                    </InsurablePurchase>
                </InsuranceRequest>
            </primary_document>
        </primary_data>
    </raw_receipt>
    <signature
        sigid       = "AUTH::20:01:01:01:64::1"
        type        = "signature"
        reason      = "Fulfilled"
        comment     = "sign 1"
        algorithm   = "MD5WithRSAEncryption"
        signor_id   = "AUTH::20:01:01:01:64"
        key_id      = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyjxUoaZLEtDUcs+X6HCi6fkcsfo2gjQwOfhETSCeV/deJb4r4MGvZxMMxyO+cSuGaVEEhXiXTlz5lQPKpqNsIwimKKK1UC7gmklJPScbWl/VvnkHlHbYtDLocj2sxxMYRorPlhMcxG2y8jx9dtXKGuscjk6S3A2ei0Egy2iyXIwIDAQAB"
        transaction = "true"
        signature   = "GbQzb1WT0Hgo8yPy8XV7WjU9hZXV0XIsQh+DSHxItsxGuosMd6/Z7Ekhbg26qB/mtsLSNNLMsCL0OW/94eBU/AQR2CXP5v+2q8iiw+BK1iJfdGxpY6ekjX/BiJpajeLnkyyCh6AC1ffb/taGbSCR/j6LFqWy8rzE0aaKS8taqss="
    >
        <signing_date>
            <date
                year    = "1998"
                month   = "10"
                day     = "2"
                hour    = "22"
                minute  = "45"
                second  = "3">
            </date>
        </signing_date>
    </signature>
    <signature
        sigid       = "AUTH::20:01:01:01:64::2"
        type        = "signature"
        reason      = "Received"
        comment     = "sign 2"
        algorithm   = "MD5WithRSAEncryption"
        signor_id   = "AUTH::20:01:01:01:64"
        key_id      = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyjxUoaZLEtDUcs+X6HCi6fkcsfo2gjQwOfhETSCeV/deJb4r4MGvZxMMxyO+cSuGaVEEhXiXTlz5lQPKpqNsIwimKKK1UC7gmklJPScbWl/VvnkHlHbYtDLocj2sxxMYRorPlhMcxG2y8jx9dtXKGuscjk6S3A2ei0Egy2iyXIwIDAQAB"
        transaction = "true"
        signature   = "go8ZbiNmwI1bxGuW+Z4fyCVNU0IFbitfjGCBhM5rm2I9ffW6eaKNDeyicX//4FFsf6tCvpR+ZMTCkh8v8lH/62JK69yxHStnfqtYwN4NWcJkBK18RCDQGIEK35c2+XR93QVn875GwQr+eORxdE9a6ym4aFgdJ4xmllr5fbkoHoM="
    >
        <signing_date>
            <date
                year    = "1998"
                month   = "10"
                day     = "2"
                hour    = "22"
                minute  = "45"
                second  = "31">
            </date>
        </signing_date>
    </signature>
</receipt>

Appendix 1 - Raw DRI DTD top

<?xml version="1.0" encoding="US-ASCII"?>
<!-- Document Type Definition for Generic Digital Receipts -->
<!-- Copyright Differential, Inc. 1998 -->

<!-- { Start of DOCTYPE receipt -->

<!ELEMENT receipt (raw_receipt, signature+)>
    <!ATTLIST receipt 
        version         CDATA               #REQUIRED
        type            CDATA               #REQUIRED
        unique_id       ID                  #REQUIRED
    >

<!ELEMENT raw_receipt 
    (   issuer,
        recipients+,
        issue_date,
        first_signing_date,
        primary_content,
        related_receipts*
    )
>

<!ELEMENT issuer (entity)>

<!ELEMENT recipients (entity)+>

<!ELEMENT issue_date (date)>

<!ELEMENT first_signing_date (date)>

<!ELEMENT primary_content(description,primary_document)>
    <!ATTLIST primary_content
        id              CDATA               #REQUIRED
        type            CDATA               #IMPLIED
        status          CDATA               #IMPLIED
    >

<!ELEMENT description (#PCDATA)>

<!-- 
    Applications override the "primary_document" element with 
    domain-specific definitions 
-->
<!ELEMENT primary_document ANY>

<!ELEMENT related_receipts EMPTY>
    <!ATTLIST related_receipts
        id              CDATA               #REQUIRED
        relationship    CDATA               #REQUIRED
    >

<!ELEMENT signature (signing_date+) >
    <!ATTLIST signature
        sigid           CDATA               #REQUIRED
        comment         CDATA               #REQUIRED
        algorithm       CDATA               #REQUIRED
        signature       CDATA               #REQUIRED
        signor_id       CDATA               #REQUIRED
        key_id          CDATA               #REQUIRED
        certificate     CDATA               #IMPLIED
    >

<!ELEMENT entity (#PCDATA)>
    <!ATTLIST entity
        id              CDATA               #REQUIRED
        logoURL         CDATA               #IMPLIED
    >

<!ELEMENT signing_date (date)>

<!ELEMENT date EMPTY>
    <!ATTLIST date
        year            CDATA               #REQUIRED
        month           CDATA               #REQUIRED
        day             CDATA               #REQUIRED
        hours           CDATA               #IMPLIED
        minutes         CDATA               #IMPLIED
        seconds         CDATA               #IMPLIED
    >

<!-- End of DOCTYPE receipt } -->

Appendix 2 - For More Information top

The XML Recommended Specification from the World Wide Web Consortium (W3C):