Commit 5dd595d0 authored by Jérôme Maloberti's avatar Jérôme Maloberti

Correct whitespace normalization in atomic types before validation.

parent d8865607
......@@ -267,13 +267,17 @@ struct
end
(** {2 Simple type validation} *)
let rec validate_simple_type def s = match def with
let rec validate_simple_type def s =
match def with
| { st_name = Some name } when Schema_builtin.is name ->
(try Schema_builtin.validate (Schema_builtin.get name) s
with Schema_builtin.Error name ->
error (sprintf "%s isn't a valid %s"
(Utf8.to_string s) name))
let value = (match def with
{ st_variety = Atomic st; st_facets = facets } ->
normalize_white_space (fst facets.whiteSpace) s
| _ -> s) in
(try Schema_builtin.validate (Schema_builtin.get name) value
with Schema_builtin.Error name ->
error (sprintf "%s isn't a valid %s"
(Utf8.to_string value) name))
| { st_variety = Atomic st; st_facets = facets } ->
let literal = normalize_white_space (fst facets.whiteSpace) s in
let value = validate_simple_type st literal in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment