You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Thomas Francart <th...@sparna.fr> on 2019/11/14 21:47:02 UTC

[CONFIGURATION2] Handling of multiline values in INI files ?

Hello

From my test it looks like multiline values in INI files are not supported
by commons-configuration2. I need to parse files like this one :
https://github.com/glottolog/glottolog/blob/master/languoids/tree/abin1243/md.ini,
and if I access configuration entry like "glottolog" on line 19 I am
getting an empty string since the values are on the following lines.

ConfigParser in Python does support multiline values :
https://docs.python.org/3/library/configparser.html

Is there an option I missed in the INIConfiguration to handle multiline
values ? or is completely out of hope ?

Thanks
Thomas

-- 

*Thomas Francart* -* SPARNA*
Web de *données* | Architecture de l'*information* | Accès aux
*connaissances*
blog : blog.sparna.fr, site : sparna.fr, linkedin :
fr.linkedin.com/in/thomasfrancart
tel :  +33 (0)6.71.11.25.97, skype : francartthomas

Re: [CONFIGURATION2] Handling of multiline values in INI files ?

Posted by Thomas Francart <th...@sparna.fr>.
Hello Bruno

Thanks for the answer. I can't modify the original ini file.
I have opened a JIRA Ticket for this at
https://issues.apache.org/jira/browse/CONFIGURATION-770.
For now, I will (try to) default to Python.

Cheers
Thomas



Le sam. 16 nov. 2019 à 05:30, Bruno P. Kinoshita <ki...@apache.org> a
écrit :

>  Hi Thomas,
> I am not aware of a parser that supports this format i [configuration].
> Looking at JIRA, the closest I found was CONFIGURATION-324, which appears
> to work with the code from master (didn't have time to check out the latest
> release).
> But the CONFIGURATION-324 requires a \ at the end of the value. I tested
> your file, and if you add a space + \ at the end of the configuration
> files, then it works.
>
> https://gist.github.com/kinow/4f20183e579f5b33535446146daf2e69
> I think if nobody else replies here, if you could create an issue in JIRA
> that'd be great, as eventually someone would volunteer to add that either
> to an existing parser, or to a new one.
> I tested Python 3's configparser std lib module, and it parses your file
> successfully with no changes (`config['core']['links']` returns the data
> as-is, with the line-breaks etc).
>
> CheersBruno
>
>     On Friday, 15 November 2019, 10:47:23 am NZDT, Thomas Francart <
> thomas.francart@sparna.fr> wrote:
>
>  Hello
>
> From my test it looks like multiline values in INI files are not supported
> by commons-configuration2. I need to parse files like this one :
>
> https://github.com/glottolog/glottolog/blob/master/languoids/tree/abin1243/md.ini
> ,
> and if I access configuration entry like "glottolog" on line 19 I am
> getting an empty string since the values are on the following lines.
>
> ConfigParser in Python does support multiline values :
> https://docs.python.org/3/library/configparser.html
>
> Is there an option I missed in the INIConfiguration to handle multiline
> values ? or is completely out of hope ?
>
> Thanks
> Thomas
>
> --
>
> *Thomas Francart* -* SPARNA*
> Web de *données* | Architecture de l'*information* | Accès aux
> *connaissances*
> blog : blog.sparna.fr, site : sparna.fr, linkedin :
> fr.linkedin.com/in/thomasfrancart
> tel :  +33 (0)6.71.11.25.97, skype : francartthomas



-- 

*Thomas Francart* -* SPARNA*
Web de *données* | Architecture de l'*information* | Accès aux
*connaissances*
blog : blog.sparna.fr, site : sparna.fr, linkedin :
fr.linkedin.com/in/thomasfrancart
tel :  +33 (0)6.71.11.25.97, skype : francartthomas

Re: [CONFIGURATION2] Handling of multiline values in INI files ?

Posted by "Bruno P. Kinoshita" <ki...@apache.org>.
 Hi Thomas,
I am not aware of a parser that supports this format i [configuration]. Looking at JIRA, the closest I found was CONFIGURATION-324, which appears to work with the code from master (didn't have time to check out the latest release).
But the CONFIGURATION-324 requires a \ at the end of the value. I tested your file, and if you add a space + \ at the end of the configuration files, then it works.

https://gist.github.com/kinow/4f20183e579f5b33535446146daf2e69
I think if nobody else replies here, if you could create an issue in JIRA that'd be great, as eventually someone would volunteer to add that either to an existing parser, or to a new one.
I tested Python 3's configparser std lib module, and it parses your file successfully with no changes (`config['core']['links']` returns the data as-is, with the line-breaks etc).

CheersBruno

    On Friday, 15 November 2019, 10:47:23 am NZDT, Thomas Francart <th...@sparna.fr> wrote:  
 
 Hello

From my test it looks like multiline values in INI files are not supported
by commons-configuration2. I need to parse files like this one :
https://github.com/glottolog/glottolog/blob/master/languoids/tree/abin1243/md.ini,
and if I access configuration entry like "glottolog" on line 19 I am
getting an empty string since the values are on the following lines.

ConfigParser in Python does support multiline values :
https://docs.python.org/3/library/configparser.html

Is there an option I missed in the INIConfiguration to handle multiline
values ? or is completely out of hope ?

Thanks
Thomas

-- 

*Thomas Francart* -* SPARNA*
Web de *données* | Architecture de l'*information* | Accès aux
*connaissances*
blog : blog.sparna.fr, site : sparna.fr, linkedin :
fr.linkedin.com/in/thomasfrancart
tel :  +33 (0)6.71.11.25.97, skype : francartthomas