XML false vs (string) false

How can I imagine true / false as a boolean and true / false string in XML?

Eg.

<problem>false</problem>
<problem>problem_name</problem>

Or is there a better way to do this?

+3
source share
4 answers

Do you want to distinguish between "real" booleans and the text "true" and "false"?

Good - an attribute can help you - for example, IsActive. For "text":

<problem>false</problem>

For booleans:

<problem IsActive="false"></problem>
+2
source

This is an ordinary unwritten rule that speaks in xml as a boolean that we should use: 'true' and 'false'

You can see more information here: http://www.w3.org/TR/xmlschema-2/#boolean

+1
source

, , , false .

, , , . - , . , , (), , .. "false" false . , , .

+1

true, false, 1, 0, true false.

"3.2.2 boolean

[Definition:] boolean has a value space · needed to support the mathematical concept of binary logic: {true, false}. 3.2.2.1 Lexical representation

An instance of a data type that is defined as · boolean can have the following legal literals: {true, false, 1, 0}. 3.2.2.2 Canonical representation

The canonical representation for boolean means many literals {true, false}.

0
source

Source: https://habr.com/ru/post/1726432/


All Articles