[Xml-compile] boolean encoding

Mark Overmeer mark at overmeer.net
Sat May 24 21:52:51 BST 2008


* Allan Wind (allan at goldbamboo.com) [080524 18:39]:
> Looking at the XSD specification I am not sure if false/true is the
> preferred way (they refer to it as "Canonical representation").  The
> XML::Compile documentation says:

I think we only should look at the Lexical Space...

> boolean
>     Contains true, false, 1 (is true), or 0 (is false). Unchecked, the
> actual value is used. Otherwise, 0 and 1 are preferred for the hash
> value and true and false in XML.

Wow, that doc is poor.  In the beginning, the check() was merged inside
the format() and parse(), but once they got seperated that was not
reflected in the documentation.

> That is I am seeing the unchecked behavior, but both the check options
> are enabled by default and I do not disable them.  This is with 0.78,
> btw, and I do not notice anything in the changelog saying this was
> fixed.

Disabling validation will not disable the logic how to interpret fields.
What about the new text:

  =function boolean
  Contains C<true>, C<false>, C<1> (is true), or C<0> (is false).
  When the writer sees a value equal to 'true' or 'false', those are
  used.  Otherwise, the trueth value is evaluated into '0' or '1'.

  The reader will return '0' (also when the XML contains the string
  'false', to simplify the Perl code) or '1'.

Better?
-- 
Thanks for the tip.

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list