在OmniXMLPath單元中更改PosEX,現在它可以工作。
function TXMLXPathEvaluator.PosEx(ch: WideChar; const s: XmlString; offset: integer = 1): integer;
var
quoteCount, startIndex, stopIndex: integer;
startText, stopText : String;
begin
quoteCount := 0;
startText := ''; startIndex := 0;
stopText := ''; stopIndex := 0;
for Result := offset to Length(s) do begin
if (s[Result] = '=') and (startText = '') then begin
startText := '=';
startIndex := Result;
end
else if (s[Result] = '''') and (startText = '=') and ((startIndex+1) = Result) then begin
startText := '=''';
startIndex := -1;
end
else begin
startText := '';
startIndex := 0;
end;
if (s[Result] = '''') and (stopText = '') then begin
stopText := '''';
stopIndex := Result;
end
else if (s[Result] = ']') and (stopText = '''') and ((stopIndex+1) = Result) then begin
stopText := ''']';
stopIndex := -1;
end
else begin
stopText := '';
stopIndex := 0;
end;
if startIndex = -1 then Inc(quoteCount);
if stopIndex = -1 then Dec(quoteCount);
if (s[Result] = ch) and (quoteCount = 0) then
Exit;
end;
Result := 0;
end; { TXMLXPathEvaluator.PosEx }