Skip to main content

parse_boolean

Function parse_boolean 

Source
pub fn parse_boolean(value: &str) -> Result<bool, String>
Expand description

Parse a boolean attribute value.

xs:boolean has a fixed whiteSpace=collapse facet (XSD Part 2 §3.3.2), so " 1 " must parse as true. We do not use str::trim because it strips the full Unicode whitespace set, but §4.3.6 defines the whiteSpace facet over only #x20 #x9 #xA #xD. Values padded with non-XML whitespace (e.g. NBSP U+00A0) must still be rejected.