I changed unit uROMSXMLImpl. please check source please.
any performance issue in my code?
before:
procedure TROMSXMLNode.SetValue(const Value: Variant);
var
s: UnicodeString;
begin
s := VarToWideStrDef(Value, '');
if isCDATA(s) then
fNode.appendChild(fNode.ownerDocument.createCDATASection(ExtractCDATA(s)))
else
fNode.text := s;
end;
after:
procedure TROMSXMLNode.SetValue(const Value: Variant);
var
s: UnicodeString;
function StripUnwantedChar(Text: string):string;
var
NotAllowed: Set of Char;
i, LeftOvers: Integer;
begin
NotAllowed := [#$1..#$8,#$E..#$1F,#$7F..#$84,#$86..#$9F];
SetLength(Result, Length(Text));
LeftOvers := 1;
for i := 1 to Length(Text) do begin
if not (Text[i] in NotAllowed) then begin
Result[LeftOvers]:= Text[i];
Inc(LeftOvers);
end
end;
SetLength(Result, LeftOvers-1);
end;
begin
s := VarToWideStrDef(Value, '');
if isCDATA(s) then
fNode.appendChild(fNode.ownerDocument.createCDATASection(ExtractCDATA(s)))
else
fNode.text := StripUnwantedChar(s);
end;