Details
-
Bug
-
Status: Closed
-
Must
-
Resolution: Fixed
-
None
-
None
-
None
-
Low
-
Description
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:
<conditionalResources> <conditionalResource> <path>/lib/yourmodule-api-1.10.*</path> <modules> <module> <moduleId>metadatasharing</moduleId> <version>1.*</version> </module> <module> <moduleId>metadatamapping</moduleId> <version>1.*</version> </module> </modules> </conditionalResource> </conditionalResources>
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
<conditionalResources> <conditionalResource> <path>/lib/yourmodule-api-1.10.*</path> <loadIfModulesPresent> <openmrsModule> <moduleId>metadatasharing</artifactId> <version>1.*</version> </openmrsModule> <openmrsModule> <moduleId>metadatamapping</artifactId> <version>1.*</version> </openmrsModule> </loadIfModulesPresent> </conditionalResource> </conditionalResources>
The other variant of loading conditional resources remains unchanged
<conditionalResources> <conditionalResource> <path>/lib/yourmodule-api-1.10.*</path> <openmrsVersion>1.10</openmrsVersion> </conditionalResource> </conditionalResources>
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
SUMMARY OF FIXES:
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.
conditionalResources
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 @@ (messages*), (mappingFiles?) (packagesWithMappedClasses?) + (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
Attachments
Issue Links
- relates to
-
TRUNK-4578 Ignore tests based on OpenMRS core version and modules
-
- Closed
-
- links to
- mentioned in
-
Page Loading...