[gdal-dev] Logics of CPLGetXMLValue and CPLFetchBool
Even Rouault
even.rouault at spatialys.com
Wed Nov 15 03:40:32 PST 2017
On mercredi 15 novembre 2017 10:58:23 CET Ari Jolma wrote:
> I thought it would be perhaps good to have CPLGetXMLBoolean since we
> have CPLFetchBool and many of the option values needed by the new WCS
> driver are boolean flags and the option values end up in the service
> XML. It would twist the brain a bit less if one could simply use
> CPLGetXMLBoolean.
>
> The logic of CPLFetchBool is that it is true if a key exists but is not
> defined or if the value is not something considered untrue ('NO', etc).
> The logic of CPLGetXMLValue is that it returns the given default in the
> case the element/attribute is not found or if it is found but is empty,
> i.e., not defined.
>
> Thus the return value of CPLGetXMLBoolean can't use CPLGetXMLValue if it
> follows the logic of CPLFetchBool. That is true is existence and no denial.
>
Why not
CPLGetXMLBoolean(node) == CPLTestBool(CPLGetXMLValue(node,NULL,"NO")) ?
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171115/65a430d9/attachment.html>
More information about the gdal-dev
mailing list