Browse Source

* be more verbose on exceptions

git-svn-id: trunk@14119 -
ivost 15 years ago
parent
commit
d111f9220d
1 changed files with 26 additions and 26 deletions
  1. 26 26
      packages/libxml/src/xmlxsd.pas

+ 26 - 26
packages/libxml/src/xmlxsd.pas

@@ -17,7 +17,7 @@ uses
   SysUtils;
   SysUtils;
 
 
 resourcestring
 resourcestring
-  ParserError = 'parsing "%s" failed';
+  ParserError = 'parsing "%s" as "%s" failed';
   ChildNotFound = 'child %s not found';
   ChildNotFound = 'child %s not found';
   PropNotFound  = 'attribute %s not found';
   PropNotFound  = 'attribute %s not found';
 
 
@@ -1160,151 +1160,151 @@ end;
 procedure xsdParseString(Chars, Last: xmlCharPtr; out Value: String);
 procedure xsdParseString(Chars, Last: xmlCharPtr; out Value: String);
 begin
 begin
   if not xsdTryParseString(Chars, Last, Value) then
   if not xsdTryParseString(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:string']);
 end;
 end;
 
 
 procedure xsdParseBoolean(Chars, Last: xmlCharPtr; out Value: Boolean);
 procedure xsdParseBoolean(Chars, Last: xmlCharPtr; out Value: Boolean);
 begin
 begin
   if not xsdTryParseBoolean(Chars, Last, Value) then
   if not xsdTryParseBoolean(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:boolean']);
 end;
 end;
 
 
 procedure xsdParseDate(Chars, Last: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PTimezone; BC: PBoolean);
 procedure xsdParseDate(Chars, Last: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PTimezone; BC: PBoolean);
 begin
 begin
   if not xsdTryParseDate(Chars, Last, Year, Month, Day, Timezone, BC) then
   if not xsdTryParseDate(Chars, Last, Year, Month, Day, Timezone, BC) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:date']);
 end;
 end;
 
 
 procedure xsdParseDate(Chars, Last: xmlCharPtr; out Value: TDateTime; Timezone: PTimezone);
 procedure xsdParseDate(Chars, Last: xmlCharPtr; out Value: TDateTime; Timezone: PTimezone);
 begin
 begin
   if not xsdTryParseDate(Chars, Last, Value, Timezone) then
   if not xsdTryParseDate(Chars, Last, Value, Timezone) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:date']);
 end;
 end;
 
 
 procedure xsdParseTime(Chars, Last: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PTimezone);
 procedure xsdParseTime(Chars, Last: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PTimezone);
 begin
 begin
   if not xsdTryParseTime(Chars, Last, Hour, Minute, Second, Milliseconds, Timezone) then
   if not xsdTryParseTime(Chars, Last, Hour, Minute, Second, Milliseconds, Timezone) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:time']);
 end;
 end;
 
 
 procedure xsdParseTime(Chars, Last: xmlCharPtr; out Value: TDateTime; Timezone: PTimezone);
 procedure xsdParseTime(Chars, Last: xmlCharPtr; out Value: TDateTime; Timezone: PTimezone);
 begin
 begin
   if not xsdTryParseTime(Chars, Last, Value, Timezone) then
   if not xsdTryParseTime(Chars, Last, Value, Timezone) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:time']);
 end;
 end;
 
 
 procedure xsdParseDateTime(Chars, Last: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PTimezone; BC: PBoolean);
 procedure xsdParseDateTime(Chars, Last: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PTimezone; BC: PBoolean);
 begin
 begin
   if not xsdTryParseDateTime(Chars, Last, Year, Month, Day, Hour, Minute, Second, Milliseconds, Timezone, BC) then
   if not xsdTryParseDateTime(Chars, Last, Year, Month, Day, Hour, Minute, Second, Milliseconds, Timezone, BC) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:dateTime']);
 end;
 end;
 
 
 procedure xsdParseDateTime(Chars, Last: xmlCharPtr; out Value: TDateTime; Timezone: PTimezone);
 procedure xsdParseDateTime(Chars, Last: xmlCharPtr; out Value: TDateTime; Timezone: PTimezone);
 begin
 begin
   if not xsdTryParseDateTime(Chars, Last, Value, Timezone) then
   if not xsdTryParseDateTime(Chars, Last, Value, Timezone) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:dateTime']);
 end;
 end;
 
 
 procedure xsdParseDecimal(Chars, Last: xmlCharPtr; out Value: Extended);
 procedure xsdParseDecimal(Chars, Last: xmlCharPtr; out Value: Extended);
 begin
 begin
   if not xsdTryParseDecimal(Chars, Last, Value) then
   if not xsdTryParseDecimal(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:decimal']);
 end;
 end;
 
 
 procedure xsdParseDouble(Chars, Last: xmlCharPtr; out Value: Double);
 procedure xsdParseDouble(Chars, Last: xmlCharPtr; out Value: Double);
 begin
 begin
   if not xsdTryParseDouble(Chars, Last, Value) then
   if not xsdTryParseDouble(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:double']);
 end;
 end;
 
 
 procedure xsdParseFloat(Chars, Last: xmlCharPtr; out Value: Single);
 procedure xsdParseFloat(Chars, Last: xmlCharPtr; out Value: Single);
 begin
 begin
   if not xsdTryParseFloat(Chars, Last, Value) then
   if not xsdTryParseFloat(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:float']);
 end;
 end;
 
 
 procedure xsdParseInteger(Chars, Last: xmlCharPtr; out Value: Int64);
 procedure xsdParseInteger(Chars, Last: xmlCharPtr; out Value: Int64);
 begin
 begin
   if not xsdTryParseInteger(Chars, Last, Value) then
   if not xsdTryParseInteger(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:integer']);
 end;
 end;
 
 
 procedure xsdParseNonNegativeInteger(Chars, Last: xmlCharPtr; out Value: QWord);
 procedure xsdParseNonNegativeInteger(Chars, Last: xmlCharPtr; out Value: QWord);
 begin
 begin
   if not xsdTryParseNonNegativeInteger(Chars, Last, Value) then
   if not xsdTryParseNonNegativeInteger(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:nonNegativeInteger']);
 end;
 end;
 
 
 procedure xsdParseNonPositiveInteger(Chars, Last: xmlCharPtr; out Value: Int64);
 procedure xsdParseNonPositiveInteger(Chars, Last: xmlCharPtr; out Value: Int64);
 begin
 begin
   if not xsdTryParseNonPositiveInteger(Chars, Last, Value) then
   if not xsdTryParseNonPositiveInteger(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:nonPositiveInteger']);
 end;
 end;
 
 
 procedure xsdParseNegativeInteger(Chars, Last: xmlCharPtr; out Value: Int64);
 procedure xsdParseNegativeInteger(Chars, Last: xmlCharPtr; out Value: Int64);
 begin
 begin
   if not xsdTryParseNegativeInteger(Chars, Last, Value) then
   if not xsdTryParseNegativeInteger(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:negativeInteger']);
 end;
 end;
 
 
 procedure xsdParsePositiveInteger(Chars, Last: xmlCharPtr; out Value: QWord);
 procedure xsdParsePositiveInteger(Chars, Last: xmlCharPtr; out Value: QWord);
 begin
 begin
   if not xsdTryParsePositiveInteger(Chars, Last, Value) then
   if not xsdTryParsePositiveInteger(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:positiveInteger']);
 end;
 end;
 
 
 procedure xsdParseByte(Chars, Last: xmlCharPtr; out Value: Shortint);
 procedure xsdParseByte(Chars, Last: xmlCharPtr; out Value: Shortint);
 begin
 begin
   if not xsdTryParseByte(Chars, Last, Value) then
   if not xsdTryParseByte(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:byte']);
 end;
 end;
 
 
 procedure xsdParseShort(Chars, Last: xmlCharPtr; out Value: Smallint);
 procedure xsdParseShort(Chars, Last: xmlCharPtr; out Value: Smallint);
 begin
 begin
   if not xsdTryParseShort(Chars, Last, Value) then
   if not xsdTryParseShort(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:short']);
 end;
 end;
 
 
 procedure xsdParseInt(Chars, Last: xmlCharPtr; out Value: Longint);
 procedure xsdParseInt(Chars, Last: xmlCharPtr; out Value: Longint);
 begin
 begin
   if not xsdTryParseInt(Chars, Last, Value) then
   if not xsdTryParseInt(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:int']);
 end;
 end;
 
 
 procedure xsdParseLong(Chars, Last: xmlCharPtr; out Value: Int64);
 procedure xsdParseLong(Chars, Last: xmlCharPtr; out Value: Int64);
 begin
 begin
   if not xsdTryParseLong(Chars, Last, Value) then
   if not xsdTryParseLong(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:long']);
 end;
 end;
 
 
 procedure xsdParseUnsignedByte(Chars, Last: xmlCharPtr; out Value: Byte);
 procedure xsdParseUnsignedByte(Chars, Last: xmlCharPtr; out Value: Byte);
 begin
 begin
   if not xsdTryParseUnsignedByte(Chars, Last, Value) then
   if not xsdTryParseUnsignedByte(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:unsignedByte']);
 end;
 end;
 
 
 procedure xsdParseUnsignedShort(Chars, Last: xmlCharPtr; out Value: Word);
 procedure xsdParseUnsignedShort(Chars, Last: xmlCharPtr; out Value: Word);
 begin
 begin
   if not xsdTryParseUnsignedShort(Chars, Last, Value) then
   if not xsdTryParseUnsignedShort(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:unsignedShort']);
 end;
 end;
 
 
 procedure xsdParseUnsignedInt(Chars, Last: xmlCharPtr; out Value: Longword);
 procedure xsdParseUnsignedInt(Chars, Last: xmlCharPtr; out Value: Longword);
 begin
 begin
   if not xsdTryParseUnsignedInt(Chars, Last, Value) then
   if not xsdTryParseUnsignedInt(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:unsignedInt']);
 end;
 end;
 
 
 procedure xsdParseUnsignedLong(Chars, Last: xmlCharPtr; out Value: QWord);
 procedure xsdParseUnsignedLong(Chars, Last: xmlCharPtr; out Value: QWord);
 begin
 begin
   if not xsdTryParseUnsignedLong(Chars, Last, Value) then
   if not xsdTryParseUnsignedLong(Chars, Last, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:unsignedLong']);
 end;
 end;
 
 
 procedure xsdParseEnum(Chars, Last: xmlCharPtr; enum: array of String; out Value: Integer);
 procedure xsdParseEnum(Chars, Last: xmlCharPtr; enum: array of String; out Value: Integer);
 begin
 begin
   if not xsdTryParseEnum(Chars, Last, enum, Value) then
   if not xsdTryParseEnum(Chars, Last, enum, Value) then
-    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last)]);
+    raise XSDException.CreateFmt(ParserError, [__strpas(Chars,Last), 'xs:enum']);
 end;
 end;
 
 
 function xsdNewChildString(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: String): xmlNodePtr;
 function xsdNewChildString(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: String): xmlNodePtr;