Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5403

Add and fix config xml dtd file 1.6



    • Bug
    • Status: Closed
    • Must
    • Resolution: Fixed
    • None
    • Core 2.4.0, Platform 2.3.0
    • None
    • None
    • Low


      Fix the DTD file for the config.xml in version 1.6 and upload it to the resources of org/openmrs/module/dtd so its also are under version control, can easily be found, edited and uploaded back to resource.openmrs.org.

      Fix the DTDs since its currently invalid:

      • the element module was redeclared when introducing the conditionalResources element in the following variant:

      This is not possible since module is already our root element with a totally different structure (allowed children elements, ...). We can thus not create a DTD for the above since its not valid XML.

      We agreed on the naming the module element thats a child of conditionalResource to loadIfModulesPresent which looks like


      The other variant of loading conditional resources remains unchanged


      NOTE: the openmrsVersion element has an "alias" element named openmrsPlatformVersion although the wiki doesnt mention this, this is how openmrs-core has implemented it (ModuleFileParser treats it the same as openmrsVersion and takes either or to set the fieldfield openmrsPlatformVersion of object ModuleConditionalResource), although usage on github shows no use of openmrsPlatformVersion instead openmrsVersion is used exclusively. I decided to keep both elements to not break any existing code.

      Furthermore, the DTD for version 1.6 was never uploaded to http://resources.openmrs.org/doctype/config-1.6.dtd. Once the DTD is in the core repo it will automatically be uploaded to the URL as implemented in https://talk.openmrs.org/t/update-http-resources-openmrs-org-doctype-config-dtd-files-1-0-1-5/18017/4?u=teleivo


      I fixed DTDs according to descriptions here https://wiki.openmrs.org/display/docs/Module+Config+File and by searching github.com to double check on how modules define their config.xml.


      changes as discussed here https://talk.openmrs.org/t/fix-config-xml-dtd-file-version-1-6/17505/6

      • add optional element conditionalResources which needs a minimum of 1 conditionalResource if added to config.xml
      • conditionalResource requires a path element, and either openmrsVersion or openmrsPlatformVersion or loadIfModulesPresent
      • loadIfModulesPresent requires at least 1 openmrsModule with required moduleId and version child elements

      Difference between the DTD Version 1.5 and 1.6 after the fix

      follows the Config.dtd Version History:

      diff -u api/src/main/resources/org/openmrs/module/dtd/config-1.5.dtd api/src/main/resources/org/openmrs/module/dtd/config-1.6.dtd
      --- api/src/main/resources/org/openmrs/module/dtd/config-1.5.dtd	2018-05-12 09:13:25.000000000 +0200
      +++ api/src/main/resources/org/openmrs/module/dtd/config-1.6.dtd	2018-05-17 19:17:06.000000000 +0200
      @@ -29,8 +29,9 @@
      +		(conditionalResources?)
      -	<!ATTLIST module configVersion CDATA #FIXED "1.5">
      +	<!ATTLIST module configVersion CDATA #FIXED "1.6">
       	<!ELEMENT id (#PCDATA)>
       	<!ELEMENT name (#PCDATA)>
      @@ -108,3 +109,11 @@
       	<!ELEMENT mappingFiles (#PCDATA)>
       	<!ELEMENT packagesWithMappedClasses (#PCDATA)>
      +	<!ELEMENT conditionalResources (conditionalResource+)>
      +	<!ELEMENT conditionalResource (path, (openmrsVersion | loadIfModulesPresent))>
      +	<!ELEMENT path (#PCDATA)>
      +	<!ELEMENT openmrsVersion (#PCDATA)>
      +	<!ELEMENT loadIfModulesPresent (openmrsModule+)>
      +	<!ELEMENT openmrsModule (moduleId, version)>
      +	<!ELEMENT moduleId (#PCDATA)>

      Gliffy Diagrams


          Issue Links



                gcliff CLIFF GITA
                teleivo Ivo Ulrich
                0 Vote for this issue
                5 Start watching this issue