"boolean" types can have leading and trailing spaces

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/xmlada@114606 936e1b1b-40f2-da11-902a-00137254ae57
This commit is contained in:
Emmanuel Briot
2007-07-30 10:31:57 +00:00
committed by briot
parent f9f0d3f536
commit 2ca8f4166b
2 changed files with 46 additions and 40 deletions

View File

@@ -747,6 +747,9 @@ package body Schema.Validators.Simple_Types is
Empty_Element : Boolean)
is
pragma Unreferenced (Empty_Element);
First : Integer := Ch'First;
Index : Integer;
C : Unicode_Char;
begin
if Debug then
Debug_Output ("Validate_Characters for boolean --" & Ch & "--"
@@ -755,13 +758,51 @@ package body Schema.Validators.Simple_Types is
Check_Facet (Validator.Facets, Ch);
if Ch /= "true"
and then Ch /= "false"
and then Ch /= "0"
and then Ch /= "1"
-- Skip leading spaces
while First <= Ch'Last loop
Index := First;
Encoding.Read (Ch, First, C);
exit when not Is_White_Space (C);
end loop;
if C = Digit_Zero or C = Digit_One then
if First <= Ch'Last then
Encoding.Read (Ch, First, C);
end if;
elsif Index + True_Sequence'Length - 1 <= Ch'Last
and then Ch (Index .. Index + True_Sequence'Length - 1) = True_Sequence
then
First := Index + True_Sequence'Length;
elsif Index + False_Sequence'Length - 1 <= Ch'Last
and then Ch (Index .. Index + False_Sequence'Length - 1) =
False_Sequence
then
First := Index + False_Sequence'Length;
else
Validation_Error ("Invalid value for boolean type: """ & Ch & """");
end if;
-- Skip trailing spaces
while First <= Ch'Last loop
Encoding.Read (Ch, First, C);
if not Is_White_Space (C) then
Validation_Error
("Invalid value for boolean type: """ & Ch & """");
end if;
end loop;
--
--
-- if Ch (First .. Ch'Last) /= "true"
-- and then Ch (First .. Ch'Last) /= "false"
-- and then Ch (First .. Ch'Last) /= "0"
-- and then Ch (First .. Ch'Last) /= "1"
-- then
-- Validation_Error ("Invalid value for boolean type: """ & Ch & """");
-- end if;
end Validate_Characters;
---------------

View File

@@ -53673,19 +53673,6 @@ Schema: xmlschema/sunData/ElemDecl/minOccurs/minOccurs00201m/minOccurs00201m.xs
Test: minOccurs00201m1_n (xmlschema/sunData/ElemDecl/minOccurs/minOccurs00201m/minOccurs00201m1_n.xml)
Pass: xmlschema/sunData/ElemDecl/minOccurs/minOccurs00201m/minOccurs00201m1_n.xml:18:8: Unexpected end of sequence, expecting "Local"
TestSet: ElemDecl
Group: name00101m
Schema: xmlschema/sunData/ElemDecl/name/name00101m/name00101m.xsd
Test: name00101m1_p (xmlschema/sunData/ElemDecl/name/name00101m/name00101m1_p.xml)
Error: XML Must be valid
xmlschema/sunData/ElemDecl/name/name00101m/name00101m1_p.xml:15:1: Invalid value for boolean type: "
true
"
TestSet: ElemDecl
Group: name00101m
Schema: xmlschema/sunData/ElemDecl/name/name00101m/name00101m.xsd
@@ -53979,17 +53966,6 @@ Schema: xmlschema/sunData/ElemDecl/term/term00101m/term00101m.xsd
Test: term00101m1_n (xmlschema/sunData/ElemDecl/term/term00101m/term00101m1_n.xml)
Pass: xmlschema/sunData/ElemDecl/term/term00101m/term00101m1_n.xml:18:15: Invalid value for boolean type: "Yes"
TestSet: ElemDecl
Group: typedef00101m
Schema: xmlschema/sunData/ElemDecl/typeDef/typeDef00101m/typeDef00101m.xsd
Test: typeDef00101m1_p (xmlschema/sunData/ElemDecl/typeDef/typeDef00101m/typeDef00101m1_p.xml)
Error: XML Must be valid
xmlschema/sunData/ElemDecl/typeDef/typeDef00101m/typeDef00101m1_p.xml:16:1: Invalid value for boolean type: "
true
"
TestSet: ElemDecl
Group: typedef00101m
Schema: xmlschema/sunData/ElemDecl/typeDef/typeDef00101m/typeDef00101m.xsd
@@ -54027,17 +54003,6 @@ Schema: xmlschema/sunData/ElemDecl/typeDef/typeDef00202m/typeDef00202m.xsd
Test: typeDef00202m1_n (xmlschema/sunData/ElemDecl/typeDef/typeDef00202m/typeDef00202m1_n.xml)
Pass: xmlschema/sunData/ElemDecl/typeDef/typeDef00202m/typeDef00202m1_n.xml:14:17: Invalid value for boolean type: "Yes"
TestSet: ElemDecl
Group: typedef00203m
Schema: xmlschema/sunData/ElemDecl/typeDef/typeDef00203m/typeDef00203m.xsd
Test: typeDef00203m1_p (xmlschema/sunData/ElemDecl/typeDef/typeDef00203m/typeDef00203m1_p.xml)
Error: XML Must be valid
xmlschema/sunData/ElemDecl/typeDef/typeDef00203m/typeDef00203m1_p.xml:16:1: Invalid value for boolean type: "
true
"
TestSet: ElemDecl
Group: typedef00203m
Schema: xmlschema/sunData/ElemDecl/typeDef/typeDef00203m/typeDef00203m.xsd
@@ -84971,4 +84936,4 @@ Schema: ipo6 (xmlschema/boeingData/ipo6/ipo.xsd)
Error: SCHEMA must be valid
xmlschema/boeingData/ipo6/ipo.xsd:10:83: /home/briot/svn/trunk/xmlada/schema/test/xmlschema2006-11-06/boeingData/ipo6/address.xsd:8:97: Type is not a valid replacement for "string"
Schemas: 13794 XML: 24447 Errors: 2117
Schemas: 13794 XML: 24447 Errors: 2114