UiPath Documentation
activities
latest
false
Importante :
A tradução automática foi aplicada parcialmente neste conteúdo. A localização de um conteúdo recém-publicado pode levar de 1 a 2 semanas para ficar disponível.

Atividades do desenvolvedor

Última atualização 21 de mai de 2026

Execute XPath

UiPath.WebAPI.Activities.ExecuteXPath

Executa a expressão XPath especificada em um determinado documento XML. Para obter mais informações sobre a sintaxe XPath, acesse aqui.

Propriedades

Entrada

  • ExistingXML - An XDocument variable containing the XML to be processed. Completing this field makes the XMLString field unusable. This field supports only XDocument variables.
  • XMLString - A string or string variable containing the XML to be processed. Completing this field makes the ExistingXML field unusable. This field supports only strings and string variables.
  • XPathExpression - A string or string variable that contains an XPath expression. This field supports only strings and string variables.

Diversos

  • Privado - Se selecionado, os valores de variáveis e argumentos não são mais registrados no nível Verbose.

Comum

  • DisplayName - O nome de exibição da atividade.

Saída

  • Result - An Object variable containing the retrieved nodes or node-sets of the given XML. This field supports only Object variables.

Exemplo de como usar a atividade Execute XPath

The Execute XPath activity is used for reading and extracting data from .xml files.

To exemplify how to use this activity, we have created an example that uses the Execute XPath activity for extracting the name of a person from a .xml file.

É assim que um processo de automação pode ser construído:

  1. Abra o Studio e crie um Processo.
    Observação:

    Make sure to place the .xml file inside the project folder. For this example we used the XMLfiles.txt.

  2. Drag a Sequence to the Workflow Designer.
    • Crie as seguintes variáveis:

      Nome da variávelTipo de VariávelValor Padrão
      XMLStringString
      ResultObject
  3. Drag a Read Text File activity inside the sequence container.
    • In the Properties panel, add the name Read XML file in the DisplayName field.
    • Add the value "XMLfiles.txt" in the FileName field.
    • Add the variable XMLString in the Content field.
  4. Adicione uma atividade Execute XPath após a atividade Read Text File.
    • In the Properties panel, add the variable XMLString in the XMLString field.
    • Add the value "string(/catalog/book/author/text()[1])" in the XPathExpression field. This expression extracts the text found in the author field from the xml file.
    • Adicione a variável Result no campo Resultado.
  5. Arraste uma atividade Write Line após a atividade Execute XPath.
    • Adicione a expressão "Result: " + Result.ToString no campo Texto.
  6. Run the process. The robot extracts the name of the author from the .xml file and displays it in the Output panel.
  • Propriedades
  • Entrada
  • Diversos
  • Comum
  • Saída
  • Exemplo de como usar a atividade Execute XPath

Esta página foi útil?

Conectar

Precisa de ajuda? Suporte

Quer aprender? Academia UiPath

Tem perguntas? Fórum do UiPath

Fique por dentro das novidades