Allow closing config elems with </> if from envvar

The Cyclone DDS configuration is in principle an XML document, but it is
possible to write configuration fragments directly in the CYCLONEDDS_URI
environment variable.  In that case, it is quite annoying to have to
enter the full closing tags all the time, and so it now allows closing
elements with a simple </> when not reading them from a file.

While it would be trivial to also allow this when reading the
configuration from a file, it seems that promulgating invalid XML would
be bad form ... and besides, in that case editors can help keep
everything in order.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-05-04 15:26:53 +08:00 committed by eboasson
parent f601beb907
commit 326ab93572
3 changed files with 21 additions and 12 deletions

View file

@ -2685,7 +2685,7 @@ struct cfgst * config_init (const char *configfile)
if (tok[0] == '<') {
/* Read XML directly from input string */
qx = ddsrt_xmlp_new_string (tok, cfgst, &cb);
ddsrt_xmlp_set_requireEOF (qx, 0);
ddsrt_xmlp_set_options (qx, DDSRT_XMLP_ANONYMOUS_CLOSE_TAG);
fp = NULL;
} else {
char *comma;