Переглянути джерело

XML Templates now pass strict validation

Stan Janssen 4 роки тому
батько
коміт
04370e57e3
28 змінених файлів з 162 додано та 155 видалено
  1. 4 4
      openleadr/templates/oadrCancelOpt.xml
  2. 4 4
      openleadr/templates/oadrCancelPartyRegistration.xml
  3. 4 4
      openleadr/templates/oadrCancelReport.xml
  4. 4 4
      openleadr/templates/oadrCanceledOpt.xml
  5. 4 4
      openleadr/templates/oadrCanceledPartyRegistration.xml
  6. 7 7
      openleadr/templates/oadrCanceledReport.xml
  7. 6 6
      openleadr/templates/oadrCreateOpt.xml
  8. 12 12
      openleadr/templates/oadrCreatePartyRegistration.xml
  9. 4 4
      openleadr/templates/oadrCreateReport.xml
  10. 7 7
      openleadr/templates/oadrCreatedEvent.xml
  11. 19 19
      openleadr/templates/oadrCreatedPartyRegistration.xml
  12. 7 7
      openleadr/templates/oadrCreatedReport.xml
  13. 5 5
      openleadr/templates/oadrDistributeEvent.xml
  14. 2 2
      openleadr/templates/oadrPayload.xml
  15. 4 4
      openleadr/templates/oadrPoll.xml
  16. 4 4
      openleadr/templates/oadrQueryRegistration.xml
  17. 10 10
      openleadr/templates/oadrRegisterReport.xml
  18. 4 4
      openleadr/templates/oadrRegisteredReport.xml
  19. 4 4
      openleadr/templates/oadrRequestEvent.xml
  20. 4 4
      openleadr/templates/oadrRequestReregistration.xml
  21. 5 5
      openleadr/templates/oadrResponse.xml
  22. 7 7
      openleadr/templates/oadrUpdateReport.xml
  23. 9 9
      openleadr/templates/oadrUpdatedReport.xml
  24. 4 4
      openleadr/templates/parts/eiEvent.xml
  25. 8 1
      openleadr/templates/parts/eiEventDescriptor.xml
  26. 1 1
      openleadr/templates/parts/eiEventSignal.xml
  27. 7 7
      openleadr/templates/parts/oadrReportDescription.xml
  28. 2 2
      openleadr/templates/parts/oadrReportRequest.xml

+ 4 - 4
openleadr/templates/oadrCancelOpt.xml

@@ -1,7 +1,7 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCancelOpt ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCancelOpt ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ request_id }}</requestID>
     <ei:optID>{{ opt_id }}</ei:optID>
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrCancelOpt>
-</oadrSignedObject>
+  </oadr:oadrCancelOpt>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrCancelPartyRegistration.xml

@@ -1,7 +1,7 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCancelPartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCancelPartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ request_id }}</requestID>
     <ei:registrationID>{{ registration_id }}</ei:registrationID>
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrCancelPartyRegistration>
-</oadrSignedObject>
+  </oadr:oadrCancelPartyRegistration>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrCancelReport.xml

@@ -1,8 +1,8 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCancelReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCancelReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ request_id }}</requestID>
     <ei:reportRequestID>{{ report_request_id }}</ei:reportRequestID>
     <reportToFollow xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ report_to_follow|booleanformat }}</reportToFollow>
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrCancelReport>
-</oadrSignedObject>
+  </oadr:oadrCancelReport>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrCanceledOpt.xml

@@ -1,10 +1,10 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCanceledOpt ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCanceledOpt ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
       <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ response.request_id }}</requestID>
     </ei:eiResponse>
     <ei:optID>{{ opt_id }}</ei:optID>
-  </oadrCanceledOpt>
-</oadrSignedObject>
+  </oadr:oadrCanceledOpt>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrCanceledPartyRegistration.xml

@@ -1,5 +1,5 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCanceledPartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCanceledPartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
@@ -7,5 +7,5 @@
     </ei:eiResponse>
     <ei:registrationID>{{ registration_id }}</ei:registrationID>
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrCanceledPartyRegistration>
-</oadrSignedObject>
+  </oadr:oadrCanceledPartyRegistration>
+</oadr:oadrSignedObject>

+ 7 - 7
openleadr/templates/oadrCanceledReport.xml

@@ -1,17 +1,17 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCanceledReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCanceledReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
       <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ response.request_id }}</requestID>
     </ei:eiResponse>
-    <oadrPendingReports>
+    <oadr:oadrPendingReports>
       {% for pending_report in pending_reports %}
       <ei:reportRequestID>{{ pending_report.request_id }}</ei:reportRequestID>
       {% endfor %}
-    </oadrPendingReports>
-    {% if ven_id %}
+    </oadr:oadrPendingReports>
+    {% if ven_id is defined and ven_id is not none %}
     <ei:venID>{{ ven_id }}</ei:venID>
     {% endif %}
-  </oadrCanceledReport>
-</oadrSignedObject>
+  </oadr:oadrCanceledReport>
+</oadr:oadrSignedObject>

+ 6 - 6
openleadr/templates/oadrCreateOpt.xml

@@ -1,13 +1,13 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCreateOpt ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110" xmlns:xcal="urn:ietf:params:xml:ns:icalendar-2.0" xmlns:emix="http://docs.oasis-open.org/ns/emix/2011/06">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCreateOpt ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110" xmlns:xcal="urn:ietf:params:xml:ns:icalendar-2.0" xmlns:emix="http://docs.oasis-open.org/ns/emix/2011/06">
     <ei:optID>{{ opt_id }}</ei:optID>
     <ei:optType>{{ opt_type }}</ei:optType>
     <ei:optReason>{{ opt_reason }}</ei:optReason>
-    {% if market_context %}
+    {% if market_context is defined and market_context is not none %}
     <emix:marketContext>{{ market_context }}</emix:marketContext>
     {% endif %}
     <ei:venID>{{ ven_id }}</ei:venID>
-    {% if vavailability %}
+    {% if vavailability is defined and vavailability is not none %}
     <xcal:vavailability></xcal:vavailability>
     {% endif %}
     <ei:createdDateTime>{{ created_date_time|datetimeformat }} </ei:createdDateTime>
@@ -19,5 +19,5 @@
     {% for target in targets %}
     {% include 'parts/eiTarget.xml' %}
     {% endfor %}
-  </oadrCreateOpt>
-</oadrSignedObject>
+  </oadr:oadrCreateOpt>
+</oadr:oadrSignedObject>

+ 12 - 12
openleadr/templates/oadrCreatePartyRegistration.xml

@@ -1,15 +1,15 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCreatePartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCreatePartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ request_id }}</requestID>
-    {% if ven_id %}
+    {% if ven_id is defined and ven_id is not none %}
     <ei:venID>{{ ven_id }}</ei:venID>
     {% endif %}
-    <oadrProfileName>{{ profile_name }}</oadrProfileName>
-    <oadrTransportName>{{ transport_name }}</oadrTransportName>
-    <oadrTransportAddress>{{ transport_address }}</oadrTransportAddress>
-    <oadrReportOnly>{{ report_only|booleanformat }}</oadrReportOnly>
-    <oadrXmlSignature>{{ xml_signature|booleanformat }}</oadrXmlSignature>
-    <oadrVenName>{{ ven_name }}</oadrVenName>
-    <oadrHttpPullModel>{{ http_pull_model|booleanformat }}</oadrHttpPullModel>
-  </oadrCreatePartyRegistration>
-</oadrSignedObject>
+    <oadr:oadrProfileName>{{ profile_name }}</oadr:oadrProfileName>
+    <oadr:oadrTransportName>{{ transport_name }}</oadr:oadrTransportName>
+    <oadr:oadrTransportAddress>{{ transport_address }}</oadr:oadrTransportAddress>
+    <oadr:oadrReportOnly>{{ report_only|booleanformat }}</oadr:oadrReportOnly>
+    <oadr:oadrXmlSignature>{{ xml_signature|booleanformat }}</oadr:oadrXmlSignature>
+    <oadr:oadrVenName>{{ ven_name }}</oadr:oadrVenName>
+    <oadr:oadrHttpPullModel>{{ http_pull_model|booleanformat }}</oadr:oadrHttpPullModel>
+  </oadr:oadrCreatePartyRegistration>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrCreateReport.xml

@@ -1,9 +1,9 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCreateReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCreateReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ request_id }}</requestID>
     {% for report_request in report_requests %}
     {% include 'parts/oadrReportRequest.xml' %}
     {% endfor %}
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrCreateReport>
-</oadrSignedObject>
+  </oadr:oadrCreateReport>
+</oadr:oadrSignedObject>

+ 7 - 7
openleadr/templates/oadrCreatedEvent.xml

@@ -1,19 +1,19 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCreatedEvent ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCreatedEvent ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <eiCreatedEvent xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">
       <ei:eiResponse>
         <ei:responseCode>{{ response.response_code }}</ei:responseCode>
         <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
-        {% if response.request_id %}
+        {% if response.request_id is defined and response.request_id is not none %}
         <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ response.request_id }}</requestID>
         {% endif %}
       </ei:eiResponse>
-      {% if event_responses %}
+      {% if event_responses is defined and event_response is not none %}
       <ei:eventResponses>
         {% for event_response in event_responses %}
         <ei:eventResponse>
           <ei:responseCode>{{ event_response.response_code }}</ei:responseCode>
-          {% if event_response.response_description %}
+          {% if event_response.response_description is defined and event_response.response_description is not none %}
           <ei:responseDescription>{{ event_response.response_description }}</ei:responseDescription>
           {% endif %}
           <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ event_response.request_id }}</requestID>
@@ -28,5 +28,5 @@
       {% endif %}
       <ei:venID>{{ ven_id }}</ei:venID>
     </eiCreatedEvent>
-  </oadrCreatedEvent>
-</oadrSignedObject>
+  </oadr:oadrCreatedEvent>
+</oadr:oadrSignedObject>

+ 19 - 19
openleadr/templates/oadrCreatedPartyRegistration.xml

@@ -1,41 +1,41 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCreatedPartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCreatedPartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
       <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ response.request_id }}</requestID>
     </ei:eiResponse>
-    {% if registration_id %}
+    {% if registration_id is defined and registration_id is not none %}
     <ei:registrationID>{{ registration_id }}</ei:registrationID>
     {% else %}
     <ei:registrationID />
     {% endif %}
 
-    {% if ven_id %}
+    {% if ven_id is defined and ven_id is not none %}
     <ei:venID>{{ ven_id }}</ei:venID>
     {% else %}
     <ei:venID />
     {% endif %}
 
     <ei:vtnID>{{ vtn_id }}</ei:vtnID>
-    <oadrProfiles>
+    <oadr:oadrProfiles>
     {% for profile in profiles %}
-      <oadrProfile>
-        <oadrProfileName>{{ profile.profile_name }}</oadrProfileName>
-        <oadrTransports>
+      <oadr:oadrProfile>
+        <oadr:oadrProfileName>{{ profile.profile_name }}</oadr:oadrProfileName>
+        <oadr:oadrTransports>
           {% for transport in profile.transports %}
-          <oadrTransport>
-            <oadrTransportName>simpleHttp</oadrTransportName>
-          </oadrTransport>
+          <oadr:oadrTransport>
+            <oadr:oadrTransportName>simpleHttp</oadr:oadrTransportName>
+          </oadr:oadrTransport>
           {% endfor %}
-        </oadrTransports>
-      </oadrProfile>
+        </oadr:oadrTransports>
+      </oadr:oadrProfile>
     {% endfor %}
-    </oadrProfiles>
-    {% if requested_oadr_poll_freq %}
-    <oadrRequestedOadrPollFreq>
+    </oadr:oadrProfiles>
+    {% if requested_oadr_poll_freq is defined and requested_oadr_poll_freq is not none %}
+    <oadr:oadrRequestedOadrPollFreq>
       <duration xmlns="urn:ietf:params:xml:ns:icalendar-2.0">{{ requested_oadr_poll_freq|timedeltaformat }}</duration>
-    </oadrRequestedOadrPollFreq>
+    </oadr:oadrRequestedOadrPollFreq>
     {% endif %}
-  </oadrCreatedPartyRegistration>
-</oadrSignedObject>
+  </oadr:oadrCreatedPartyRegistration>
+</oadr:oadrSignedObject>

+ 7 - 7
openleadr/templates/oadrCreatedReport.xml

@@ -1,17 +1,17 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrCreatedReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrCreatedReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
       <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ response.request_id }}</requestID>
     </ei:eiResponse>
-    <oadrPendingReports>
+    <oadr:oadrPendingReports>
       {% for pending_report in pending_reports %}
       <ei:reportRequestID>{{ pending_report.request_id }}</ei:reportRequestID>
       {% endfor %}
-    </oadrPendingReports>
-    {% if ven_id %}
+    </oadr:oadrPendingReports>
+    {% if ven_id is defined and ven_id is not none %}
     <ei:venID>{{ ven_id }}</ei:venID>
     {% endif %}
-  </oadrCreatedReport>
-</oadrSignedObject>
+  </oadr:oadrCreatedReport>
+</oadr:oadrSignedObject>

+ 5 - 5
openleadr/templates/oadrDistributeEvent.xml

@@ -1,6 +1,6 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrDistributeEvent ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
-    {% if response %}
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrDistributeEvent ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+    {% if response is defined and response is not none %}
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
@@ -12,5 +12,5 @@
     {% for event in events %}
         {% include 'parts/eiEvent.xml' %}
     {% endfor %}
-  </oadrDistributeEvent>
-</oadrSignedObject>
+  </oadr:oadrDistributeEvent>
+</oadr:oadrSignedObject>

+ 2 - 2
openleadr/templates/oadrPayload.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<oadr:oadrPayload xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07">
+<oadrPayload xmlns="http://openadr.org/oadr-2.0b/2012/07">
 {% if signature: %}{{ signature|safe }}{% endif %}
 {{ signed_object|safe }}
-</oadr:oadrPayload>
+</oadrPayload>

+ 4 - 4
openleadr/templates/oadrPoll.xml

@@ -1,5 +1,5 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrPoll ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <oadr:oadrPoll ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrPoll>
-</oadrSignedObject>
+  </oadr:oadrPoll>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrQueryRegistration.xml

@@ -1,5 +1,5 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrQueryRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrQueryRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ request_id }}</requestID>
-  </oadrQueryRegistration>
-</oadrSignedObject>
+  </oadr:oadrQueryRegistration>
+</oadr:oadrSignedObject>

+ 10 - 10
openleadr/templates/oadrRegisterReport.xml

@@ -1,14 +1,14 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrRegisterReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrRegisterReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ request_id }}</requestID>
 {% for report in reports %}
-    <oadrReport xmlns:xcal="urn:ietf:params:xml:ns:icalendar-2.0" xmlns:strm="urn:ietf:params:xml:ns:icalendar-2.0:stream">
-      {% if report.dtstart %}
+    <oadr:oadrReport xmlns:xcal="urn:ietf:params:xml:ns:icalendar-2.0" xmlns:strm="urn:ietf:params:xml:ns:icalendar-2.0:stream">
+      {% if report.dtstart is defined and report.dtstart is not none %}
       <xcal:dtstart>
         <xcal:date-time>{{ report.duration|timedeltaformat }}</xcal:date-time>
       </xcal:dtstart>
       {% endif %}
-      {% if report.duration %}
+      {% if report.duration is defined and report.duration is not none %}
       <xcal:duration>
         <xcal:duration>{{ report.duration|timedeltaformat }}</xcal:duration>
       </xcal:duration>
@@ -21,13 +21,13 @@
       <ei:reportSpecifierID>{{ report.report_specifier_id }}</ei:reportSpecifierID>
       <ei:reportName>{{ report.report_name }}</ei:reportName>
       <ei:createdDateTime>{{ report.created_date_time|datetimeformat }}</ei:createdDateTime>
-    </oadrReport>
+    </oadr:oadrReport>
 {% endfor %}
-    {% if ven_id %}
+    {% if ven_id is defined and ven_id is not none %}
     <ei:venID>{{ ven_id }}</ei:venID>
     {% endif %}
-    {% if report_request_id %}
+    {% if report_request_id is defined and report_request_id is not none %}
     <ei:reportRequestID>{{ report_request_id }}</ei:reportRequestID>
     {% endif %}
-  </oadrRegisterReport>
-</oadrSignedObject>
+  </oadr:oadrRegisterReport>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrRegisteredReport.xml

@@ -1,5 +1,5 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrRegisteredReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrRegisteredReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
@@ -9,5 +9,5 @@
     {% include 'parts/oadrReportRequest.xml' %}
     {% endfor %}
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrRegisteredReport>
-</oadrSignedObject>
+  </oadr:oadrRegisteredReport>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrRequestEvent.xml

@@ -1,8 +1,8 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrRequestEvent ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrRequestEvent ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <eiRequestEvent xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">
       <requestID>{{ request_id }}</requestID>
       <ei:venID>{{ ven_id }}</ei:venID>
     </eiRequestEvent>
-  </oadrRequestEvent>
-</oadrSignedObject>
+  </oadr:oadrRequestEvent>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/oadrRequestReregistration.xml

@@ -1,5 +1,5 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrRequestReregistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrRequestReregistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrRequestReregistration>
-</oadrSignedObject>
+  </oadr:oadrRequestReregistration>
+</oadr:oadrSignedObject>

+ 5 - 5
openleadr/templates/oadrResponse.xml

@@ -1,14 +1,14 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrResponse ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrResponse ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
-      {% if response.request_id and response.request_id is not none %}
+      {% if response.request_id is defined and response.request_id is not none %}
       <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">{{ response.request_id }}</requestID>
       {% else %}
       <requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads" />
       {% endif %}
     </ei:eiResponse>
     <ei:venID>{{ ven_id }}</ei:venID>
-  </oadrResponse>
-</oadrSignedObject>
+  </oadr:oadrResponse>
+</oadr:oadrSignedObject>

+ 7 - 7
openleadr/templates/oadrUpdateReport.xml

@@ -1,9 +1,9 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" xmlns:pyld="http://docs.oasis-open.org/ns/energyinterop/201110/payloads" xmlns:emix="http://docs.oasis-open.org/ns/emix/2011/06" Id="oadrSignedObject">
-  <oadrUpdateReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" xmlns:pyld="http://docs.oasis-open.org/ns/energyinterop/201110/payloads" xmlns:emix="http://docs.oasis-open.org/ns/emix/2011/06" oadr:Id="oadrSignedObject">
+  <oadr:oadrUpdateReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">
     <pyld:requestID>{{ request_id }}</pyld:requestID>
     {% if reports %}
     {% for report in reports %}
-    <oadrReport>
+    <oadr:oadrReport>
       <ei:eiReportID>{{ report.report_id }}</ei:eiReportID>
       {% if report.report_descriptions %}
       {% for r_id, report_description in report.report_descriptions.items() %}
@@ -16,11 +16,11 @@
       <ei:createdDateTime>{{ report.created_date_time|datetimeformat }}</ei:createdDateTime>
       {% endfor %}
       {% endif %}
-    </oadrReport>
+    </oadr:oadrReport>
     {% endfor %}
     {% endif %}
-    {% if ven_id %}
+    {% if ven_id is defined and ven_id is not none %}
     <ei:venID>{{ ven_id }}</ei:venID>
     {% endif %}
-  </oadrUpdateReport>
-</oadrSignedObject>
+  </oadr:oadrUpdateReport>
+</oadr:oadrSignedObject>

+ 9 - 9
openleadr/templates/oadrUpdatedReport.xml

@@ -1,16 +1,16 @@
-<oadrSignedObject xmlns="http://openadr.org/oadr-2.0b/2012/07" Id="oadrSignedObject">
-  <oadrUpdatedReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110" xmlns:pyld="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">
+<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject">
+  <oadr:oadrUpdatedReport ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110" xmlns:pyld="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">
     <ei:eiResponse>
       <ei:responseCode>{{ response.response_code }}</ei:responseCode>
       <ei:responseDescription>{{ response.response_description }}</ei:responseDescription>
-      {% if response.request_id %}
+      {% if response.request_id is defined and response.request_id is not none %}
       <pyld:requestID>{{ response.request_id }}</pyld:requestID>
       {% else %}
       <pyld:requestID />
       {% endif %}
     </ei:eiResponse>
-    {% if cancel_report %}
-    <oadrCancelReport>
+    {% if cancel_report is defined and cancel_report is not none %}
+    <oadr:oadrCancelReport>
       <pyld:requestID>{{ cancel_report.request_id }}</pyld:requestID>
       {% for report_request_id in cancel_report.report_request_id %}
       <ei:reportRequestID>{{ report_request_id }}</ei:reportRequestID>
@@ -19,10 +19,10 @@
       {% if cancel_report.ven_id %}
       <ei:venID>{{ cancel_report.ven_id }}</ei:venID>
       {% endif %}
-    </oadrCancelReport>
+    </oadr:oadrCancelReport>
     {% endif %}
-    {% if ven_id %}
+    {% if ven_id is defined and ven_id is not none %}
     <ei:venID>{{ ven_id }}</ei:venID>
     {% endif %}
-  </oadrUpdatedReport>
-</oadrSignedObject>
+  </oadr:oadrUpdatedReport>
+</oadr:oadrSignedObject>

+ 4 - 4
openleadr/templates/parts/eiEvent.xml

@@ -1,4 +1,4 @@
-<oadrEvent>
+<oadr:oadrEvent>
     <ei:eiEvent>
         {% include 'parts/eiEventDescriptor.xml' %}
         {% include 'parts/eiActivePeriod.xml' %}
@@ -14,9 +14,9 @@
             {% endfor %}
         </ns1>
         {% endif %}
-        {% if event.targets %}
+        {% if event.targets is defined and event.targets is not none %}
         {% include 'parts/eiEventTarget.xml' %}
         {% endif %}
     </ei:eiEvent>
-    <oadrResponseRequired>{{ event.response_required }}</oadrResponseRequired>
-</oadrEvent>
+    <oadr:oadrResponseRequired>{{ event.response_required }}</oadr:oadrResponseRequired>
+</oadr:oadrEvent>

+ 8 - 1
openleadr/templates/parts/eiEventDescriptor.xml

@@ -1,9 +1,12 @@
 <ei:eventDescriptor>
     <ei:eventID>{{ event.event_descriptor.event_id }}</ei:eventID>
     <ei:modificationNumber>{{ event.event_descriptor.modification_number }}</ei:modificationNumber>
-    {% if event.event_descriptor.modification_date_time is not none %}
+    {% if event.event_descriptor.modification_date_time is defined and event.event_descriptor.modification_date_time is not none %}
     <ei:modificationDateTime>{{ event.event_descriptor.modification_date_time|datetimeformat }}</ei:modificationDateTime>
     {% endif %}
+    {% if event.event_descriptor.modification_reason is defined and event.event_descriptor.modification_reason is not none %}
+    <ei:modificationReason>{{ event.event_descriptor.modification_reason }}</ei:modificationReason>
+    {% endif %}
     {%if event.event_descriptor.priority is not none %}
     <ei:priority>{{ event.event_descriptor.priority }}</ei:priority>
     {% endif %}
@@ -12,6 +15,10 @@
     </ei:eiMarketContext>
     <ei:createdDateTime>{{ event.event_descriptor.created_date_time|datetimeformat }}</ei:createdDateTime>
     <ei:eventStatus>{{ event.event_descriptor.event_status }}</ei:eventStatus>
+    {% if event.event_descriptor.test_event is defined and event.event_descriptor.test_event is not none %}
     <ei:testEvent>{{ event.event_descriptor.test_event|booleanformat }}</ei:testEvent>
+    {% endif %}
+    {% if event.event_descriptor.vtn_comment is defined and event.event_descriptor.vtn_comment is not none %}
     <ei:vtnComment>{{ event.event_descriptor.vtn_comment }}</ei:vtnComment>
+    {% endif %}
 </ei:eventDescriptor>

+ 1 - 1
openleadr/templates/parts/eiEventSignal.xml

@@ -19,7 +19,7 @@
     <ei:signalName>{{ signal.signal_name }}</ei:signalName>
     <ei:signalType>{{ signal.signal_type }}</ei:signalType>
     <ei:signalID>{{ signal.signal_id }}</ei:signalID>
-    {% if signal.current_value is not none %}
+    {% if signal.current_value is defined and signal.current_value is not none %}
     <ei:currentValue>
         <ei:payloadFloat>
             <ei:value>{{ signal.current_value }}</ei:value>

+ 7 - 7
openleadr/templates/parts/oadrReportDescription.xml

@@ -1,4 +1,4 @@
-<oadrReportDescription xmlns:emix="http://docs.oasis-open.org/ns/emix/2011/06">
+<oadr:oadrReportDescription xmlns:emix="http://docs.oasis-open.org/ns/emix/2011/06">
   <ei:rID>{{ r_id }}</ei:rID>
   {% if report_description.report_subjects %}
   <ei:reportSubject>
@@ -89,10 +89,10 @@
   <emix:marketContext>{{ report_description.market_context }}</emix:marketContext>
   {% endif %}
   {% if report_description.sampling_rate %}
-  <oadrSamplingRate>
-    <oadrMinPeriod>{{ report_description.sampling_rate.min_period|timedeltaformat }}</oadrMinPeriod>
-    <oadrMaxPeriod>{{ report_description.sampling_rate.max_period|timedeltaformat }}</oadrMaxPeriod>
-    <oadrOnChange>{{ report_description.sampling_rate.on_change|booleanformat }}</oadrOnChange>
-  </oadrSamplingRate>
+  <oadr:oadrSamplingRate>
+    <oadr:oadrMinPeriod>{{ report_description.sampling_rate.min_period|timedeltaformat }}</oadr:oadrMinPeriod>
+    <oadr:oadrMaxPeriod>{{ report_description.sampling_rate.max_period|timedeltaformat }}</oadr:oadrMaxPeriod>
+    <oadr:oadrOnChange>{{ report_description.sampling_rate.on_change|booleanformat }}</oadr:oadrOnChange>
+  </oadr:oadrSamplingRate>
   {% endif %}
-</oadrReportDescription>
+</oadr:oadrReportDescription>

+ 2 - 2
openleadr/templates/parts/oadrReportRequest.xml

@@ -1,4 +1,4 @@
-<oadrReportRequest>
+<oadr:oadrReportRequest>
   <ei:reportRequestID>{{ report_request.report_request_id }}</ei:reportRequestID>
   <ei:reportSpecifier xmlns:xcal="urn:ietf:params:xml:ns:icalendar-2.0">
     <ei:reportSpecifierID>{{ report_request.report_specifier.report_specifier_id }}</ei:reportSpecifierID>
@@ -47,4 +47,4 @@
       <ei:readingType>{{ report_request.report_specifier.specifier_payload.reading_type }}</ei:readingType>
     </ei:specifierPayload>
   </ei:reportSpecifier>
-</oadrReportRequest>
+</oadr:oadrReportRequest>