Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML false vs (string) false

Tags:

How can I represent, true/false as the Boolean and "true"/"false" the strings in XML?

Eg.

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

Or is there a better way to do this?

like image 922
steven Avatar asked Dec 23 '09 09:12

steven


2 Answers

According to the spec, you can use the literal values true, false, 1, 0 but you should use true or false only.

Chris

"3.2.2 boolean

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

An instance of a datatype 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 is the set of literals {true, false}."

like image 58
Chris McCauley Avatar answered Oct 12 '22 09:10

Chris McCauley


It is a common unwritten rule that says in xml as a boolean value we should use: 'true' and 'false'

You can look here for further information: http://www.w3.org/TR/xmlschema-2/#boolean

like image 42
kokosing Avatar answered Oct 12 '22 07:10

kokosing