<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Ari Jolma kirjoitti 15.11.2017 klo 15:51:<br>
<blockquote type="cite"
cite="mid:eb0402e0-b3a5-a059-bcdd-ca73626b9215@gmail.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<p>Even Rouault kirjoitti 15.11.2017 klo 13:40:
</p>
<blockquote type="cite" cite="mid:2854483.VsgTqnpGyM@even-i700">
<meta name="qrichtext" content="1">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On mercredi 15 novembre 2017 10:58:23 CET Ari Jolma wrote:</p>
<br>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> Thus the return value of CPLGetXMLBoolean can't use CPLGetXMLValue if it</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> follows the logic of CPLFetchBool. That is true is existence and no denial.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Why not</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"> CPLGetXMLBoolean(node) == CPLTestBool(CPLGetXMLValue(node,NULL,"NO")) ?</p>
</blockquote>
<br>
Ah, but I want to test with node *and* path. Node will be the top
level node of the service XML.<br>
<br>
Anyway, I think I need to start with <br>
<br>
CSLFetchNameValueDef(poOpenInfo->papszOpenOptions<br>
<br>
and based on that explicitly set the element value to "TRUE" if
the option exists and is not false. Then I can rely on the value
of the element being "TRUE" if it is set.<br>
</blockquote>
<br>
I think the best approach is<br>
<br>
CPLGetXMLBoolean(node, path) == <br>
<br>
node = CPLGetXMLNode(node, path);<br>
if node == NULL return FALSE;<br>
value = CPLGetXMLValue(node, NULL, "");<br>
if value == "" return TRUE;<br>
return CPLTestBool(value);<br>
<br>
This should return TRUE if the node exists and does not contain
something that is considered untrue in GDAL, which is consistent
with how CPLFetchBool() behaves.<br>
<br>
Ari<br>
<br>
<br>
<blockquote type="cite"
cite="mid:eb0402e0-b3a5-a059-bcdd-ca73626b9215@gmail.com"> <br>
Ari<br>
<br>
<br>
<blockquote type="cite" cite="mid:2854483.VsgTqnpGyM@even-i700">
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-- </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Spatialys - Geospatial professional services</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><a class="moz-txt-link-freetext" href="http://www.spatialys.com" moz-do-not-send="true">http://www.spatialys.com</a></p>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>