lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5721] Add a top-level 'data_source' attribute


From: Greg Chicares
Subject: [lmi-commits] [5721] Add a top-level 'data_source' attribute
Date: Sun, 28 Apr 2013 18:28:18 +0000

Revision: 5721
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5721
Author:   chicares
Date:     2013-04-28 18:28:17 +0000 (Sun, 28 Apr 2013)
Log Message:
-----------
Add a top-level 'data_source' attribute

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/multiple_cell_document.cpp
    lmi/trunk/multiple_cell_document.rnc
    lmi/trunk/multiple_cell_document.xsd
    lmi/trunk/sample.cns
    lmi/trunk/sample.ill
    lmi/trunk/single_cell_document.cpp
    lmi/trunk/single_cell_document.hpp
    lmi/trunk/single_cell_document.rnc
    lmi/trunk/single_cell_document.xsd

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2013-04-24 15:41:27 UTC (rev 5720)
+++ lmi/trunk/ChangeLog 2013-04-28 18:28:17 UTC (rev 5721)
@@ -32271,3 +32271,18 @@
   xmlwrapp-0.7.0.patch   [new file]
 Upgrade to xmlwrapp-0.7.0 .
 
+20130428T1828Z <address@hidden> [542]
+
+  multiple_cell_document.cpp
+  multiple_cell_document.rnc
+  multiple_cell_document.xsd
+  sample.ill
+  sample.cns
+  single_cell_document.cpp
+  single_cell_document.hpp
+  single_cell_document.rnc
+  single_cell_document.xsd
+Add a top-level 'data_source' attribute. This has the same type and
+meaning as cell element 'InforceDataSource', but is handier for
+applying an xml schema only to files from external systems.
+

Modified: lmi/trunk/multiple_cell_document.cpp
===================================================================
--- lmi/trunk/multiple_cell_document.cpp        2013-04-24 15:41:27 UTC (rev 
5720)
+++ lmi/trunk/multiple_cell_document.cpp        2013-04-28 18:28:17 UTC (rev 
5721)
@@ -363,6 +363,7 @@
     xml_lmi::xml_document document(xml_root_name());
     xml::element& root = document.root_node();
     xml_lmi::set_attr(root, "version", class_version());
+    xml_lmi::set_attr(root, "data_source", 1); // "1" means lmi.
 
     xml::element case_default("case_default");
     xml::node::iterator case_i = root.insert(case_default);

Modified: lmi/trunk/multiple_cell_document.rnc
===================================================================
--- lmi/trunk/multiple_cell_document.rnc        2013-04-24 15:41:27 UTC (rev 
5720)
+++ lmi/trunk/multiple_cell_document.rnc        2013-04-28 18:28:17 UTC (rev 
5721)
@@ -33,6 +33,8 @@
 
 start = element multiple_cell_document
     {attribute version {"1"}
+    ,## Optional for now; to be required in the future.
+     attribute data_source {xsd:nonNegativeInteger}?
 
     ,element case_default     {cell_element  }
     ,element class_defaults   {cell_element +}

Modified: lmi/trunk/multiple_cell_document.xsd
===================================================================
--- lmi/trunk/multiple_cell_document.xsd        2013-04-24 15:41:27 UTC (rev 
5720)
+++ lmi/trunk/multiple_cell_document.xsd        2013-04-28 18:28:17 UTC (rev 
5721)
@@ -48,6 +48,11 @@
           </xs:restriction>
         </xs:simpleType>
       </xs:attribute>
+      <xs:attribute name="data_source" type="xs:nonNegativeInteger">
+        <xs:annotation>
+          <xs:documentation>Optional for now; to be required in the 
future.</xs:documentation>
+        </xs:annotation>
+      </xs:attribute>
     </xs:complexType>
   </xs:element>
   <xs:element name="case_default">

Modified: lmi/trunk/sample.cns
===================================================================
--- lmi/trunk/sample.cns        2013-04-24 15:41:27 UTC (rev 5720)
+++ lmi/trunk/sample.cns        2013-04-28 18:28:17 UTC (rev 5721)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<multiple_cell_document version="1">
+<multiple_cell_document version="1" data_source="1">
   <case_default>
     <cell version="7">
       <AccidentalDeathBenefit>No</AccidentalDeathBenefit>

Modified: lmi/trunk/sample.ill
===================================================================
--- lmi/trunk/sample.ill        2013-04-24 15:41:27 UTC (rev 5720)
+++ lmi/trunk/sample.ill        2013-04-28 18:28:17 UTC (rev 5721)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<single_cell_document>
+<single_cell_document version="1" data_source="1">
   <cell version="7">
     <AccidentalDeathBenefit>No</AccidentalDeathBenefit>
     <Address/>

Modified: lmi/trunk/single_cell_document.cpp
===================================================================
--- lmi/trunk/single_cell_document.cpp  2013-04-24 15:41:27 UTC (rev 5720)
+++ lmi/trunk/single_cell_document.cpp  2013-04-28 18:28:17 UTC (rev 5721)
@@ -62,6 +62,18 @@
 {
 }
 
+/// Backward-compatibility serial number of this class's xml version.
+///
+/// What is now called version 0 had no "version" attribute.
+///
+/// version 0: [prior to the lmi epoch]
+/// version 1: 20130428T1828Z
+
+int single_cell_document::class_version() const
+{
+    return 1;
+}
+
 //============================================================================
 std::string const& single_cell_document::xml_root_name() const
 {
@@ -94,6 +106,8 @@
 {
     xml_lmi::xml_document document(xml_root_name());
     xml::element& root = document.root_node();
+    xml_lmi::set_attr(root, "version", class_version());
+    xml_lmi::set_attr(root, "data_source", 1); // "1" means lmi.
     root << input_data_;
     os << document;
 }

Modified: lmi/trunk/single_cell_document.hpp
===================================================================
--- lmi/trunk/single_cell_document.hpp  2013-04-24 15:41:27 UTC (rev 5720)
+++ lmi/trunk/single_cell_document.hpp  2013-04-28 18:28:17 UTC (rev 5721)
@@ -55,6 +55,8 @@
 
   private:
     void parse(xml::element const&);
+
+    int                class_version() const;
     std::string const& xml_root_name() const;
 
     Input input_data_;

Modified: lmi/trunk/single_cell_document.rnc
===================================================================
--- lmi/trunk/single_cell_document.rnc  2013-04-24 15:41:27 UTC (rev 5720)
+++ lmi/trunk/single_cell_document.rnc  2013-04-28 18:28:17 UTC (rev 5721)
@@ -23,7 +23,14 @@
 
 # Use file extension '.ill' for single-life xml documents.
 
-start = element single_cell_document {cell_element}
+start = element single_cell_document
+    {## Optional for now; to be required in the future.
+     attribute version {"1"}?
+    ,## Optional for now; to be required in the future.
+     attribute data_source {xsd:nonNegativeInteger}?
 
+    ,cell_element
+    }
+
 include "cell.rnc"
 

Modified: lmi/trunk/single_cell_document.xsd
===================================================================
--- lmi/trunk/single_cell_document.xsd  2013-04-24 15:41:27 UTC (rev 5720)
+++ lmi/trunk/single_cell_document.xsd  2013-04-28 18:28:17 UTC (rev 5721)
@@ -25,5 +25,27 @@
   -->
   <!-- $Id$ -->
   <!-- Use file extension '.ill' for single-life xml documents. -->
-  <xs:element name="single_cell_document" type="cell_element"/>
+  <xs:element name="single_cell_document">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="cell_element">
+          <xs:attribute name="version">
+            <xs:annotation>
+              <xs:documentation>Optional for now; to be required in the 
future.</xs:documentation>
+            </xs:annotation>
+            <xs:simpleType>
+              <xs:restriction base="xs:token">
+                <xs:enumeration value="1"/>
+              </xs:restriction>
+            </xs:simpleType>
+          </xs:attribute>
+          <xs:attribute name="data_source" type="xs:nonNegativeInteger">
+            <xs:annotation>
+              <xs:documentation>Optional for now; to be required in the 
future.</xs:documentation>
+            </xs:annotation>
+          </xs:attribute>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
 </xs:schema>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]