ODAC

TOraXML.Exists Method

Checks if the given set of nodes in the TOraXML exists.

Class

TOraXML

Syntax

function Exists(const XPathExpr: string; const NSmap: string = ''): boolean;

Parameters
XPathExpr
Holds the set of nodes in the TOraXML.
NSmap
Holds a namespace map of TOraXML.
Return Value
True if specified nodes exist in TOraXML, False otherwise.

Remarks

Call the Exists method to check if the given set of nodes in TOraXML exists. This set of nodes is specified by the XPathExpr parameter.

Returns True if specified nodes exist in the TOraXML, otherwise, returns False.

Example

var
   RetDoc: TOraXML;
   Res: boolean;
begin
...
   Edit;
   TOraXMLField(FieldByName('XMLField')).AsXML.AsString := 
      '<root> '+
      '<x xmlns:edi=''http://ecommerce.org/schema''> '+
      '<b>32.18</b> '+
      '<edi:price units=''Euro''>32.18</edi:price> '+
      '</x> '+
      '</root>';
   Post;
...
   with TOraXMLField(FieldByName('XMLField')).AsXML do begin
      Res := Exists('//edi:price', 'xmlns:edi=http://ecommerce.org/schema'); //Res = True
      Res := Exists('/root/node1'); //Res = False
   end;
end; 

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback