XML Format

This page describes the XML format sample implementation.

Sample File Format

The file format is described in the Online IMD Upload hint on the Online IMD and Event Upload screen. (Select Menu, select Communication, select Load IMDs/Events (XML)).

Sample File

<deviceList>
  <device>
    <headEnd>L&G</headEnd>
    <headEndExternalId>L+G</headEndExternalId>
    <deviceId></deviceId>
    <deviceIdentifierNumber>DEV-OUSGG-OSB-DEMO-001</deviceIdentifierNumber>
    <initialMeasurementDataList>
      <initialMeasurementData>
        <preVEE>
          <mcIdN></mcIdN>
          <uom>KWH</uom>
          <stDt>2010-05-19-00.00.00</stDt>
          <enDt>2010-05-19-00.30.00</enDt>
          <spi>900</spi>
          <msrs>
            <mL>
              <s>1</s>
              <q>0.2316</q>
            </mL>
            <mL>
              <s>2</s>
              <q>0.1416</q>
            </mL>
          </msrs>
        </preVEE>
      </initialMeasurementData>
      <initialMeasurementData>
        <initialMeasurementDataId>testValue</initialMeasurementDataId>
          <preVEE>
            <mcIdN></mcIdN>
            <uom>KWH2</uom>
            <stDt>2010-05-19-00.30.00</stDt>
            <enDt>2010-05-19-01.00.00</enDt>
            <spi>900</spi>
            <msrs>
              <mL>
                <s>1</s>
                <q>1.2316</q>
              </mL>
              <mL>
                <s>2</s>
                <q>2.1416</q>
              </mL>
            </msrs>
          </preVEE>
      </initialMeasurementData>
    </initialMeasurementDataList>
  </device>
</deviceList>

Sample Scripts

The sample implementation includes the following sample scripts designed for use with the above XML format:

DG_​SmplPrXML: This sample script includes one method in the Library Interface – getParser(). The method returns an instance of the class that implements the com.splwg.d1.domain.sgg.dg.processing.PayloadParser interface. The class contains the following logic:

  1. Parses an incoming payload in XML format

  2. Fetches information about current device

  3. Breaks an incoming data into separate initial measurement data structures

  4. Extends these structures with device information

  5. Returns one by one these structures in the Plain XML format

DG_​SmplTrXML: This sample script includes one method in the Library Interface – getTransfprmer(). The method returns an instance of class that implements the com.splwg.d1.domain.sgg.dg.processing.PayloadTransformer interface. The class contains the following logic:

  1. Transforms incoming message in the Plain XML format into the IMD Seeder XML nodes

  2. Adds new XML nodes as child nodes to the given Result List

Use the Script portal to view these scripts in more detail.

Parsing

The XML parser script maps data from the above XML format into the Plain XML format.

XML Schema of Plain XML Format

<xs:schema attributeFormDefault="unqualified" 
elementFormDefault="qualified" 
targetNamespace="http://xmlns.oracle.com/GenericAdapter" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:ga="http://xmlns.oracle.com/GenericAdapter">
  <xs:element name="Payload" type="ga:PayloadType"/>
  <xs:complexType name="PayloadType">
    <xs:sequence>
      <xs:choice>
        <xs:element name="Usage" type="ga:UsageType"/>
        <xs:element name="Event" type="ga:EventType"/>
      </xs:choice>
      <xs:element name="RawData"  type="ga:NonEmptyString"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UsageType">
    <xs:sequence>
      <xs:element name="RecordType" type="ga:RecordTypeUsageType"/>
      <xs:element name="StartDateTime" type="xs:integer"/>
      <xs:element name="EndDateTime" type="xs:integer"/>
      <xs:element name="DeviceId" type="ga:NonEmptyString"/>
      <xs:element name="IntervalDuration" type="xs:integer"/>
      <xs:element name="UOM" type="ga:NonEmptyString"/>
      <xs:element name="Intervals" type="ga:IntervalList"/>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="RecordTypeUsageType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="U"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="IntervalList">
    <xs:sequence maxOccurs="unbounded">
      <xs:element name="Interval" type="ga:IntervalType"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="IntervalType">
    <xs:sequence>
      <xs:element name="Value" type="xs:float"/>
      <xs:element name="Status" type="ga:NonEmptyString" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="EventType">
    <xs:sequence>
      <xs:element name="RecordType" type="ga:RecordTypeEventType"/>
      <xs:element name="DateTime" type="xs:integer"/>
      <xs:element name="DeviceId" type="ga:NonEmptyString"/>
      <xs:element name="Name" type="ga:NonEmptyString"/>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="RecordTypeEventType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="E"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="NonEmptyString">
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>

Transformation

The transformer script performs the following mapping.

Plain XML to Seeder XML Mapping

The payload transformer script does the following:

  1. Creates an XML element with a name defined in the SGG Payload Processing Configuration field “IMD Seeder BO (Interval)” and copies all elements from the Plain XML as child nodes of new element.

  2. Inserts the “externalId” element populated with value stored in setOrigin method.

  3. Inserts the “serviceProviderExternalId” element populated with value stored in setConfiguration method.

  4. If the SGG Payload Processing Configuration has the Populate RAW checkbox checked, inserts the “rawData” element populated with the textual XML representation of Plain XML element.