mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 00:59:08 +02:00
* extended xsdFormatBoolean to write either 0/1 or false/true
git-svn-id: trunk@12541 -
This commit is contained in:
parent
9d6694a692
commit
490167ba16
@ -16,7 +16,7 @@ uses
|
|||||||
SysUtils;
|
SysUtils;
|
||||||
|
|
||||||
{ Format functions }
|
{ Format functions }
|
||||||
function xsdFormatBoolean(Value: Boolean): String;
|
function xsdFormatBoolean(Value: Boolean; UseWords: Boolean = False): String;
|
||||||
function xsdFormatDate(Year: Longint; Month, Day: Longword): String;
|
function xsdFormatDate(Year: Longint; Month, Day: Longword): String;
|
||||||
function xsdFormatDate(Value: TDateTime): String;
|
function xsdFormatDate(Value: TDateTime): String;
|
||||||
function xsdFormatTime(Hour, Minute, Second: Longword): String;
|
function xsdFormatTime(Hour, Minute, Second: Longword): String;
|
||||||
@ -57,7 +57,7 @@ function xsdParseUnsignedLong(Value: String; var P: QWord): Boolean;
|
|||||||
|
|
||||||
{ 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; UseWords: Boolean = False): xmlNodePtr;
|
||||||
function xsdNewChildDate(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day: Longword): xmlNodePtr;
|
function xsdNewChildDate(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day: Longword): xmlNodePtr;
|
||||||
function xsdNewChildTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Hour, Minute, Second: Longword): xmlNodePtr;
|
function xsdNewChildTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Hour, Minute, Second: Longword): xmlNodePtr;
|
||||||
function xsdNewChildDateTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day, Hour, Minute, Second: Longword): xmlNodePtr;
|
function xsdNewChildDateTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day, Hour, Minute, Second: Longword): xmlNodePtr;
|
||||||
@ -75,7 +75,7 @@ function xsdNewChildUnsignedLong(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlChar
|
|||||||
|
|
||||||
{ Property creation functions }
|
{ Property creation functions }
|
||||||
function xsdNewPropString(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: String): xmlAttrPtr;
|
function xsdNewPropString(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: String): xmlAttrPtr;
|
||||||
function xsdNewPropBoolean(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean): xmlAttrPtr;
|
function xsdNewPropBoolean(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean; UseWords: Boolean = False): xmlAttrPtr;
|
||||||
function xsdNewPropDate(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day: Longword): xmlAttrPtr;
|
function xsdNewPropDate(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day: Longword): xmlAttrPtr;
|
||||||
function xsdNewPropTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Hour, Minute, Second: Longword): xmlAttrPtr;
|
function xsdNewPropTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Hour, Minute, Second: Longword): xmlAttrPtr;
|
||||||
function xsdNewPropDateTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day, Hour, Minute, Second: Longword): xmlAttrPtr;
|
function xsdNewPropDateTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day, Hour, Minute, Second: Longword): xmlAttrPtr;
|
||||||
@ -150,12 +150,18 @@ function xsdRemoveBlanks(content: xmlCharPtr; out cleaned: string): boolean;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function xsdFormatBoolean(Value: Boolean): String;
|
function xsdFormatBoolean(Value: Boolean; UseWords: Boolean): String;
|
||||||
begin
|
begin
|
||||||
if Value then
|
if UseWords then
|
||||||
Result := 'true'
|
if Value then
|
||||||
|
Result := 'true'
|
||||||
|
else
|
||||||
|
Result := 'false'
|
||||||
else
|
else
|
||||||
Result := 'false';
|
if Value then
|
||||||
|
Result := '1'
|
||||||
|
else
|
||||||
|
Result := '0';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function xsdFormatDate(Year: Longint; Month, Day: Longword): String;
|
function xsdFormatDate(Year: Longint; Month, Day: Longword): String;
|
||||||
@ -438,11 +444,11 @@ begin
|
|||||||
Result := xmlNewChild(parent, ns, name, BAD_CAST(Value));
|
Result := xmlNewChild(parent, ns, name, BAD_CAST(Value));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function xsdNewChildBoolean(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean): xmlNodePtr;
|
function xsdNewChildBoolean(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean; UseWords: Boolean): xmlNodePtr;
|
||||||
var
|
var
|
||||||
Tmp: String;
|
Tmp: String;
|
||||||
begin
|
begin
|
||||||
Tmp := xsdFormatBoolean(Value);
|
Tmp := xsdFormatBoolean(Value, UseWords);
|
||||||
Result := xmlNewChild(parent, ns, name, BAD_CAST(Tmp));
|
Result := xmlNewChild(parent, ns, name, BAD_CAST(Tmp));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -563,11 +569,11 @@ begin
|
|||||||
Result := xmlNewNsProp(node, ns, name, BAD_CAST(Value));
|
Result := xmlNewNsProp(node, ns, name, BAD_CAST(Value));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function xsdNewPropBoolean(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean): xmlAttrPtr;
|
function xsdNewPropBoolean(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean; UseWords: Boolean): xmlAttrPtr;
|
||||||
var
|
var
|
||||||
Tmp: String;
|
Tmp: String;
|
||||||
begin
|
begin
|
||||||
Tmp := xsdFormatBoolean(Value);
|
Tmp := xsdFormatBoolean(Value, UseWords);
|
||||||
Result := xmlNewNsProp(node, ns, name, BAD_CAST(Tmp));
|
Result := xmlNewNsProp(node, ns, name, BAD_CAST(Tmp));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user