<!--  The IPDRDoc element is the top-level container of a set of
      IPDR's.  The document will also define the entity which 
      recorded these IPDR's via the IPDRRecorder element.
  -->
<!ELEMENT IPDRDoc  (IPDRRec , IPDRRecList? ,  (IPDR | IPDRTable )+ , IPDRDoc.End? )>
<!ATTLIST IPDRDoc  seqNum    CDATA     #IMPLIED
                   version   CDATA     #IMPLIED
                   startTime CDATA     #IMPLIED
                   info      CDATA     #IMPLIED
                   a-dtype   NMTOKENS  'seqNum    int
                                        startTime dateTime.tz' >
<!--  The IPDRDoc.End element optionally marks the end of the IPDR block.
      It may contain some check information like a count of IPDR's.
  -->
<!ELEMENT IPDRDoc.End EMPTY>
<!ATTLIST IPDRDoc.End  count   CDATA     #IMPLIED
                       endTime CDATA     #IMPLIED
                       a-dtype NMTOKENS  'count   int
                                          endTime dateTime.tz' >
<!-- The IPDRRec element describes the entity that is responsible for
     creating (recording) the IPDRDocument.
  -->
<!ELEMENT IPDRRec EMPTY>
<!ATTLIST IPDRRec  id        ID        #IMPLIED
                   startTime CDATA     #IMPLIED
                   info      CDATA     #IMPLIED
                   a-dtype   NMTOKENS  'startTime dateTime.tz' >
<!-- The IPDRRecRef element may be used to associate common references
     to the same IPDRRec element without repeating its other attributes.
  -->
<!ELEMENT IPDRRecRef EMPTY>
<!ATTLIST IPDRRecRef  ref IDREF  #REQUIRED >
<!-- The IPDRRecList identifies contributing IPDR recording entities
     which were used in the construction of the current IPDR Document.
     A typical example use would be for an aggregator of IPDR documents
     to identify the set of initial recorders presenting IPDRs
  -->
<!ELEMENT IPDRRecList  (IPDRRec+ )>

<!-- An IPDR describes an event between a Service Consumer (SC) and
     a Service Element (SE).  The SC and SE elements are contained
     beneath an entity called the ServiceSession (SS).  Details of 
     the event is contained in the Usage Event (UE) element.  All IPDR's
     have a time indicating when the event occurred.
  -->
<!ELEMENT IPDR  ( (IPDRRec | IPDRRecRef )? ,  (SS | SSRef ) , UE , BaseIPDR? )>
<!ATTLIST IPDR  id      ID        #IMPLIED
                time    CDATA     #REQUIRED
                seqNum  CDATA     #IMPLIED
                a-dtype NMTOKENS  'time   dateTime.tz
                                   seqNum int' >
<!-- The Service Session (SS) element groups the Service Consumer
     and Service Element information.  This grouping allows
     an SC/SE pair to be associated with other IPDR's via
     a single reference (the SSRef).
  -->
<!ELEMENT SS  ( (SC | SCRef ) ,  (SE | SERef ) )>
<!ATTLIST SS  id      ID     #IMPLIED
              service CDATA  #IMPLIED >
<!-- The SSRef element may be used to associate common references
     to the same pairing of a Service Consumer and a Service Element.
  -->
<!ELEMENT SSRef EMPTY>
<!ATTLIST SSRef  ref IDREF  #REQUIRED >
<!-- An IPDR's ServiceConsumer, ServiceElement and UsageEvent 
     sections are used to partition a set of attributes <v> elements
     into their appropriate categories.  The SC and SE components
     also have Reference analogs to associate common groups of 
     attributes, and reduce the number of elements in a document.
   
     All Service events indicate what type of metrics they carry.
     By default a 'Start-Stop' type indicates that it is a 
     complete measurement and does not rely on other
     records to form a complete picture of an activity.
  -->
<!ELEMENT SC  (v* )>
<!ATTLIST SC  id ID  #IMPLIED >
<!ELEMENT SE  (v* )>
<!ATTLIST SE  id ID  #IMPLIED >
<!ELEMENT UE  (v* )>
<!ATTLIST UE  type  (Start | Stop | Start-Stop | Interim )  'Start-Stop'
              name CDATA  #IMPLIED >
<!-- The SERef and SCRef elements may be used to associate common      references to the Session Element or Session Consumer.
  -->
<!ELEMENT SERef EMPTY>
<!ATTLIST SERef  ref IDREF  #REQUIRED >
<!ELEMENT SCRef EMPTY>
<!ATTLIST SCRef  ref IDREF  #REQUIRED >
<!-- The BaseIPDR element allows reference to be made to IPDRs which
     contributed to the construction of the current IPDR element.
  -->
<!ELEMENT BaseIPDR EMPTY>
<!ATTLIST BaseIPDR  refs IDREFS  #REQUIRED >
<!-- The attribute value <v> element is the main extensibility mechanism 
     of the IPDR record.  The IPDR group will define a set of named
     attributes that follow a hierarchical naming convention.
     All IPDR derived attribute names will reside under the
     org.ipdr.* hierarchy.  Based on their position in an element,
     the leading org.ipdr name of the attribute may be omitted
     for compactness.  Third party attributes must be fully
     qualified.
  -->
<!ELEMENT v  (#PCDATA )>
<!ATTLIST v  name CDATA  #IMPLIED >
<!-- An IPDRTable element is used to more compactly represent a set 
     of homogenous IPDR's.  Homogenous in the sense that each IPDR
     in a table contains the same set of describing attribute 
     elements <v> elements.  Use of IPDRTable is optional.  IPDR
     elements may directly live under the IPDRDoc if they
     do not share a common structure or verbosity is desired
     over compactness.
  -->
<!ELEMENT IPDRTable  ( (IPDRRec | IPDRRecRef )? , IPDRSchema ,  (IPDR )+ , IPDRTable.End? )>
<!ATTLIST IPDRTable  startTime CDATA     #IMPLIED
                     a-dtype   NMTOKENS  'startTime dateTime.tz' >
<!--  The IPDRTable.End element optionally marks the end of a set of IPDR's 
      in an IPDRTable element.  It may contain some check information       like a count of IPDR's.
  -->
<!ELEMENT IPDRTable.End EMPTY>
<!ATTLIST IPDRTable.End  count   CDATA     #REQUIRED
                         endTime CDATA     #IMPLIED
                         a-dtype NMTOKENS  'count   int
                                            endTime dateTime.tz' >
<!-- The IPDRSchema element within an IPDRTable defines the attribute
     elements common to all the IPDR's in the given table
  -->
<!ELEMENT IPDRSchema  (SCSchema , SESchema , UESchema )>

<!-- The following schema components define the sets of attributes
     for the ServiceConsumer (SC), ServiceElement (SE) and 
     Usage Event (UE) components of the IPDR respectively.
  -->
<!ELEMENT SCSchema  (AttrDesc+ )>

<!ELEMENT SESchema  (AttrDesc+ )>

<!ELEMENT UESchema  (AttrDesc+ )>

<!-- An AttrDesc element describes an attribute that will appear in 
     in a particular position in a subsequent set of IPDR's contained
     in a table.  One can think of this as being analogous to the
     table header <TH> elements in HTML.
  -->
<!ELEMENT AttrDesc  (#PCDATA )>

