|
@@ -18,11 +18,11 @@ uses
|
|
{ Format functions }
|
|
{ Format functions }
|
|
function xsdFormatBoolean(Value: Boolean): String;
|
|
function xsdFormatBoolean(Value: Boolean): String;
|
|
function xsdFormatDate(Year, Month, Day: Longword): String;
|
|
function xsdFormatDate(Year, Month, Day: Longword): String;
|
|
-function xsdFormatDate(Date: TDateTime): String;
|
|
|
|
|
|
+function xsdFormatDate(Value: TDateTime): String;
|
|
function xsdFormatTime(Hour, Minute, Second: Longword): String;
|
|
function xsdFormatTime(Hour, Minute, Second: Longword): String;
|
|
-function xsdFormatTime(Time: TDateTime): String;
|
|
|
|
|
|
+function xsdFormatTime(Value: TDateTime): String;
|
|
function xsdFormatDateTime(Year, Month, Day, Hour, Minute, Second: Longword): String;
|
|
function xsdFormatDateTime(Year, Month, Day, Hour, Minute, Second: Longword): String;
|
|
-function xsdFormatDateTime(DateTime: TDateTime): String;
|
|
|
|
|
|
+function xsdFormatDateTime(Value: TDateTime): String;
|
|
function xsdFormatDecimal(Value: Extended; Precision: Integer = 4; Digits: Integer = 1): String;
|
|
function xsdFormatDecimal(Value: Extended; Precision: Integer = 4; Digits: Integer = 1): String;
|
|
function xsdFormatDouble(Value: Double): String;
|
|
function xsdFormatDouble(Value: Double): String;
|
|
function xsdFormatFloat(Value: Single): String;
|
|
function xsdFormatFloat(Value: Single): String;
|
|
@@ -35,6 +35,26 @@ function xsdFormatUnsignedShort(Value: Word): String;
|
|
function xsdFormatUnsignedInt(Value: Longword): String;
|
|
function xsdFormatUnsignedInt(Value: Longword): String;
|
|
function xsdFormatUnsignedLong(Value: QWord): String;
|
|
function xsdFormatUnsignedLong(Value: QWord): String;
|
|
|
|
|
|
|
|
+{ Parse functions }
|
|
|
|
+function xsdParseBoolean(Value: String): Boolean;
|
|
|
|
+function xsdParseDate(Value: String; var Year, Month, Day: Longword): Boolean;
|
|
|
|
+function xsdParseDate(Value: String): TDateTime;
|
|
|
|
+function xsdParseTime(Value: String; var Hour, Minute, Second: Longword): Boolean;
|
|
|
|
+function xsdParseTime(Value: String): TDateTime;
|
|
|
|
+function xsdParseDateTime(Value: String; var Year, Month, Day, Hour, Minute, Second: Longword): Boolean;
|
|
|
|
+function xsdParseDateTime(Value: String): TDateTime;
|
|
|
|
+function xsdParseDecimal(Value: String): Extended;
|
|
|
|
+function xsdParseDouble(Value: String): Double;
|
|
|
|
+function xsdParseFloat(Value: String): Single;
|
|
|
|
+function xsdParseByte(Value: String): Shortint;
|
|
|
|
+function xsdParseShort(Value: String): Smallint;
|
|
|
|
+function xsdParseInt(Value: String): Longint;
|
|
|
|
+function xsdParseLong(Value: String): Int64;
|
|
|
|
+function xsdParseUnsignedByte(Value: String): Byte;
|
|
|
|
+function xsdParseUnsignedShort(Value: String): Word;
|
|
|
|
+function xsdParseUnsignedInt(Value: String): Longword;
|
|
|
|
+function xsdParseUnsignedLong(Value: String): QWord;
|
|
|
|
+
|
|
{ Node creation functions }
|
|
{ Node creation functions }
|
|
function xsdNewChildString(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: String): xmlNodePtr;
|
|
function xsdNewChildString(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: String): xmlNodePtr;
|
|
function xsdNewChildBoolean(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean): xmlNodePtr;
|
|
function xsdNewChildBoolean(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean): xmlNodePtr;
|
|
@@ -139,11 +159,11 @@ begin
|
|
Result := Format('%4.4d-%2.2d-%2.2dZ', [Year, Month, Day]);
|
|
Result := Format('%4.4d-%2.2d-%2.2dZ', [Year, Month, Day]);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function xsdFormatDate(Date: TDateTime): String;
|
|
|
|
|
|
+function xsdFormatDate(Value: TDateTime): String;
|
|
var
|
|
var
|
|
Year, Month, Day: Word;
|
|
Year, Month, Day: Word;
|
|
begin
|
|
begin
|
|
- DecodeDate(Date, Year, Month, Day);
|
|
|
|
|
|
+ DecodeDate(Value, Year, Month, Day);
|
|
Result := xsdFormatDate(Year, Month, Day);
|
|
Result := xsdFormatDate(Year, Month, Day);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -152,11 +172,11 @@ begin
|
|
Result := Format('%2.2d:%2.2d:%2.2dZ', [Hour, Minute, Second]);
|
|
Result := Format('%2.2d:%2.2d:%2.2dZ', [Hour, Minute, Second]);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function xsdFormatTime(Time: TDateTime): String;
|
|
|
|
|
|
+function xsdFormatTime(Value: TDateTime): String;
|
|
var
|
|
var
|
|
Hour, Minute, Second, Millisecond: Word;
|
|
Hour, Minute, Second, Millisecond: Word;
|
|
begin
|
|
begin
|
|
- DecodeTime(Time, Hour, Minute, Second, Millisecond);
|
|
|
|
|
|
+ DecodeTime(Value, Hour, Minute, Second, Millisecond);
|
|
Result := xsdFormatTime(Hour, Minute, Second);
|
|
Result := xsdFormatTime(Hour, Minute, Second);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -165,11 +185,11 @@ begin
|
|
Result := Format('%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2dZ', [Year, Month, Day, Hour, Minute, Second]);
|
|
Result := Format('%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2dZ', [Year, Month, Day, Hour, Minute, Second]);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function xsdFormatDateTime(DateTime: TDateTime): String;
|
|
|
|
|
|
+function xsdFormatDateTime(Value: TDateTime): String;
|
|
var
|
|
var
|
|
Year, Month, Day, Hour, Minute, Second, Millisecond: Word;
|
|
Year, Month, Day, Hour, Minute, Second, Millisecond: Word;
|
|
begin
|
|
begin
|
|
- DecodeDateTime(DateTime, Year, Month, Day, Hour, Minute, Second, Millisecond);
|
|
|
|
|
|
+ DecodeDateTime(Value, Year, Month, Day, Hour, Minute, Second, Millisecond);
|
|
Result := xsdFormatDateTime(Year, Month, Day, Hour, Minute, Second);
|
|
Result := xsdFormatDateTime(Year, Month, Day, Hour, Minute, Second);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -228,6 +248,169 @@ begin
|
|
Result := IntToStr(Value);
|
|
Result := IntToStr(Value);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function xsdParseBoolean(Value: String): Boolean;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToBool(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseDate(Value: String; var Year, Month, Day: Longword): Boolean;
|
|
|
|
+// xsd:date = [-]CCYY-MM-DD[Z|(+|-)hh:mm]
|
|
|
|
+var
|
|
|
|
+ S: String;
|
|
|
|
+ I: Integer;
|
|
|
|
+begin
|
|
|
|
+{ ignore leading - }
|
|
|
|
+ if (Length(Value) > 0) and (Value[1]='-') then
|
|
|
|
+ S := Copy(Value, 2, MaxInt)
|
|
|
|
+ else
|
|
|
|
+ S := Value;
|
|
|
|
+
|
|
|
|
+{ parse year }
|
|
|
|
+ I := Pos('-', S);
|
|
|
|
+ if (I = 0) or not TryStrToInt(Copy(S, 1, I-1), Integer(Year)) then
|
|
|
|
+ Exit(False);
|
|
|
|
+
|
|
|
|
+{ parse month }
|
|
|
|
+ S := Copy(S, I+1, MaxInt);
|
|
|
|
+ I := Pos('-', S);
|
|
|
|
+ if (I = 0) or not TryStrToInt(Copy(S, 1, I-1), Integer(Month)) then
|
|
|
|
+ Exit(False);
|
|
|
|
+
|
|
|
|
+{ parse day }
|
|
|
|
+ S := Copy(S, I+1, MaxInt);
|
|
|
|
+ Result := TryStrToInt(S, Integer(Day));
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseDate(Value: String): TDateTime;
|
|
|
|
+var
|
|
|
|
+ Year, Month, Day: Longword;
|
|
|
|
+begin
|
|
|
|
+ if xsdParseDate(Value, Year, Month, Day) then
|
|
|
|
+ Result := EncodeDate(Year, Month, Day)
|
|
|
|
+ else
|
|
|
|
+ Result := 0;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseTime(Value: String; var Hour, Minute, Second: Longword): Boolean;
|
|
|
|
+// xsd:time = hh:mm:ss[Z|(+|-)hh:mm]
|
|
|
|
+var
|
|
|
|
+ S: String;
|
|
|
|
+ I: Integer;
|
|
|
|
+begin
|
|
|
|
+ S := Value;
|
|
|
|
+
|
|
|
|
+{ parse hour }
|
|
|
|
+ I := Pos(':', S);
|
|
|
|
+ if (I = 0) or not TryStrToInt(Copy(S, 1, I-1), Integer(Hour)) or (Hour > 23) then
|
|
|
|
+ Exit(False);
|
|
|
|
+
|
|
|
|
+{ parse minute }
|
|
|
|
+ S := Copy(S, I+1, MaxInt);
|
|
|
|
+ I := Pos(':', S);
|
|
|
|
+ if (I = 0) or not TryStrToInt(Copy(S, 1, I-1), Integer(Minute)) or (Minute > 59) then
|
|
|
|
+ Exit(False);
|
|
|
|
+
|
|
|
|
+{ parse second }
|
|
|
|
+ S := Copy(S, I+1, MaxInt);
|
|
|
|
+ Result := TryStrToInt(S, Integer(Second)) and (Second < 60);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseTime(Value: String): TDateTime;
|
|
|
|
+var
|
|
|
|
+ Hour, Minute, Second: Longword;
|
|
|
|
+begin
|
|
|
|
+ if xsdParseDate(Value, Hour, Minute, Second) then
|
|
|
|
+ Result := EncodeTime(Hour, Minute, Second, 0)
|
|
|
|
+ else
|
|
|
|
+ Result := 0;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseDateTime(Value: String; var Year, Month, Day, Hour, Minute, Second: Longword): Boolean;
|
|
|
|
+// xsd:dateTime = [-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]
|
|
|
|
+var
|
|
|
|
+ S: String;
|
|
|
|
+ I: Integer;
|
|
|
|
+begin
|
|
|
|
+ S := Value;
|
|
|
|
+
|
|
|
|
+{ ignore Z }
|
|
|
|
+ I := Pos('Z', S);
|
|
|
|
+ if I > 0 then
|
|
|
|
+ S := Copy(S, 1, I-1);
|
|
|
|
+
|
|
|
|
+{ parse date and time }
|
|
|
|
+ I := Pos('T', S);
|
|
|
|
+ Result := (I > 0) and
|
|
|
|
+ xsdParseDate(Copy(S, 1, I-1), Year, Month, Day) and
|
|
|
|
+ xsdParseTime(Copy(S, I+1, MaxInt), Hour, Minute, Second);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseDateTime(Value: String): TDateTime;
|
|
|
|
+var
|
|
|
|
+ Year, Month, Day: Longword;
|
|
|
|
+ Hour, Minute, Second: Longword;
|
|
|
|
+begin
|
|
|
|
+ if xsdParseDateTime(Value, Year, Month, Day, Hour, Minute, Second) then
|
|
|
|
+ Result := EncodeDateTime(Year, Month, Day, Hour, Minute, Second, 0)
|
|
|
|
+ else
|
|
|
|
+ Result := 0;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseDecimal(Value: String): Extended;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToFloat(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseDouble(Value: String): Double;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToFloat(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseFloat(Value: String): Single;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToFloat(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseByte(Value: String): Shortint;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToInt(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseShort(Value: String): Smallint;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToInt(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseInt(Value: String): Longint;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToInt(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseLong(Value: String): Int64;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToInt64(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseUnsignedByte(Value: String): Byte;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToInt(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseUnsignedShort(Value: String): Word;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToInt(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseUnsignedInt(Value: String): Longword;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToInt(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function xsdParseUnsignedLong(Value: String): QWord;
|
|
|
|
+begin
|
|
|
|
+ Result := StrToInt64(Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
function xsdNewChildString(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: String): xmlNodePtr;
|
|
function xsdNewChildString(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: String): xmlNodePtr;
|
|
begin
|
|
begin
|
|
Result := xmlNewChild(parent, ns, name, BAD_CAST(Value));
|
|
Result := xmlNewChild(parent, ns, name, BAD_CAST(Value));
|
|
@@ -541,7 +724,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToBoolDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseBoolean(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -551,9 +734,9 @@ var
|
|
value: xmlCharPtr;
|
|
value: xmlCharPtr;
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
- {if assigned(value) then
|
|
|
|
- result := StrToBoolDef(pchar(value), defaultValue)
|
|
|
|
- else}
|
|
|
|
|
|
+ if assigned(value) then
|
|
|
|
+ result := xsdParseDate(pchar(value))
|
|
|
|
+ else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -562,9 +745,9 @@ var
|
|
value: xmlCharPtr;
|
|
value: xmlCharPtr;
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
- {if assigned(value) then
|
|
|
|
- result := StrToBoolDef(pchar(value), defaultValue)
|
|
|
|
- else}
|
|
|
|
|
|
+ if assigned(value) then
|
|
|
|
+ result := xsdParseTime(pchar(value))
|
|
|
|
+ else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -573,9 +756,9 @@ var
|
|
value: xmlCharPtr;
|
|
value: xmlCharPtr;
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
- {if assigned(value) then
|
|
|
|
- result := StrToBoolDef(pchar(value), defaultValue)
|
|
|
|
- else}
|
|
|
|
|
|
+ if assigned(value) then
|
|
|
|
+ result := xsdParseDateTime(pchar(value))
|
|
|
|
+ else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -585,7 +768,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToFloatDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseDecimal(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -596,7 +779,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToFloatDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseDouble(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -607,7 +790,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToFloatDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseFloat(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -618,7 +801,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseByte(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -629,7 +812,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseShort(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -640,7 +823,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseInt(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -651,7 +834,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseLong(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -662,7 +845,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseUnsignedByte(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -673,7 +856,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseUnsignedShort(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -684,7 +867,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseUnsignedInt(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -695,7 +878,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
value := xsdGetNsChild(node, name, nameSpace, index);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseUnsignedLong(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -761,7 +944,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToBoolDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseBoolean(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -770,10 +953,10 @@ function xsdGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; defaultVa
|
|
var
|
|
var
|
|
value: xmlCharPtr;
|
|
value: xmlCharPtr;
|
|
begin
|
|
begin
|
|
- {value := xsdGetNsProp(node, name, nameSpace);
|
|
|
|
|
|
+ value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
- else}
|
|
|
|
|
|
+ result := xsdParseDate(pchar(value))
|
|
|
|
+ else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -781,10 +964,10 @@ function xsdGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; defaultVa
|
|
var
|
|
var
|
|
value: xmlCharPtr;
|
|
value: xmlCharPtr;
|
|
begin
|
|
begin
|
|
- {value := xsdGetNsProp(node, name, nameSpace);
|
|
|
|
|
|
+ value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
- else}
|
|
|
|
|
|
+ result := xsdParseTime(pchar(value))
|
|
|
|
+ else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -792,10 +975,10 @@ function xsdGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; defau
|
|
var
|
|
var
|
|
value: xmlCharPtr;
|
|
value: xmlCharPtr;
|
|
begin
|
|
begin
|
|
- {value := xsdGetNsProp(node, name, nameSpace);
|
|
|
|
|
|
+ value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
- else}
|
|
|
|
|
|
+ result := xsdParseDateTime(pchar(value))
|
|
|
|
+ else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -805,7 +988,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToFloatDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseDecimal(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -816,7 +999,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToFloatDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseDouble(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -827,7 +1010,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToFloatDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseFloat(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -838,7 +1021,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseByte(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -849,7 +1032,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseShort(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -860,7 +1043,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseInt(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -871,7 +1054,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseLong(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -882,7 +1065,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseUnsignedByte(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -893,7 +1076,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseUnsignedShort(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -904,7 +1087,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseUnsignedInt(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -915,7 +1098,7 @@ var
|
|
begin
|
|
begin
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
value := xsdGetNsProp(node, name, nameSpace);
|
|
if assigned(value) then
|
|
if assigned(value) then
|
|
- result := StrToIntDef(pchar(value), defaultValue)
|
|
|
|
|
|
+ result := xsdParseUnsignedLong(pchar(value))
|
|
else
|
|
else
|
|
result := defaultValue;
|
|
result := defaultValue;
|
|
end;
|
|
end;
|
|
@@ -962,4 +1145,4 @@ begin
|
|
Result := False;
|
|
Result := False;
|
|
end;
|
|
end;
|
|
|
|
|
|
-end.
|
|
|
|
|
|
+end.
|