I'm using Delphi7, OmniXML.
In my xml I have a field that contains '/'
XML:
...
<R2>002-000004/13</R2>
...
When I search for value in XML that contains sign '/' my OmniXml returns error.
iNodeKupac := FXMLDocument.SelectSingleNode(
'//[R2=''' + '002-000004/13' + ''']'
);
How to preform searh on this field?
Changed PosEX in OmniXMLPath unit and now it works.
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 }