Unsupported content


This version of the product is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.


xpath.evaluate(string, expression)

Returns the result of evaluating the xpath expression against the XML string. Returns a list of strings containing the selected values. The result is always a list, even if the expression is guaranteed to always return just one result.

The expression must be one that returns tag attributes or body text - expressions returning DOM nodes will result in an error that terminates execution of the pattern.

For example, the sample code for opening, reading, and closing a file for the AirWatch.MobileDeviceManagement pattern module is:

if process.cmd matches regex '^\w:' then
      // *filepath_info_start
      // filepath_windows := "<process.cmd>.config"
      // reason := "To get database details"
      // when := "Only if trigger process has fully qualified path"
      // *filepath_info_end
      config_file := discovery.fileGet(host, '%process.cmd%.config');
      if config_file and config_file.content then
          config_file_content_xpath := xpath.openDocument(config_file.content);
          db_name_list := xpath.evaluate(config_file_content_xpath, raw '/configuration/dataConfiguration/@defaultDatabase');
          if db_name_list then
              db_name := db_name_list[0];
              db_connection_list := xpath.evaluate(config_file_content_xpath, '/configuration/connectionStrings/add[@name="%db_name%"]/@connectionString');
              if db_connection_list then
                  db_connection := db_connection_list[0];
                  db_host     := regex.extract(db_connection, regex 'Data Source=([^\\]+)\\', raw '\1');
                  db_instance := regex.extract(db_connection, regex 'Data Source=[^\\]+\\([^;]+);', raw '\1');
                  if db_host and db_instance then
                      if db_host = '(local)' then
                          db_host := 'localhost';
                      end if;
                      db_server_sis := SearchFunctions.getSoftwareNodes(host, node_address := db_host,
                                                                        software_type := "Microsoft SQL Server",
                                                                        instance := db_instance, db_name := db_name);
                      if size(db_server_sis) = 1 then
                          model.uniquerel.Communication(Client := si_node, Server := db_server_sis[0]);
                      end if;
                  end if;
              end if;
          end if;
      end if;
  end if;
Was this page helpful? Yes No Submitting... Thank you