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.
UiPath logo, featuring letters U and I in white

Atividades do desenvolvedor

Última atualização 21 de abr de 2026

Detectar e analisar um arquivo XML

O exemplo a seguir explica como usar atividades como Deserialize XML ou Execute XPath para desserializar e analisar um arquivo XML. Você pode encontrar essas atividades no pacote UiPath.WebAPI.Activities .

Observação:

Download and extract the archive with the project in this example and copy the folder MissingScreenshotSampleProject-ForTestPurposes to your project folder.

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

  1. Abra o Studio e crie um Processo.
  2. Arraste um contêiner Sequência para o Designer de Fluxo de Trabalho.
    • Crie as seguintes variáveis:

      Nome da variávelTipo de VariávelValor Padrão
      SelectedProjectPathString
      WorkflowXMLStringString
      WorkflowXMLXDocumentName
      ScreenshotAttributesObject
  3. Add a Select Folder activity inside the Sequence.
    • In the Properties panel, add the variable SelectedProjectPath in the SelectedFolder field.
  4. Adicione uma atividade For Each após a atividade Select Folder.
    • Add the value WorkflowFile in the ForEach field.
    • Add the expression Directory.GetFiles(SelectedProjectPath, "*.xaml", SearchOption.AllDirectories) in the Values field.
  5. Add a Read Text File in the Body container of the For Each activity.
    • Add the value WorkflowFile in the FileName field.
    • In the Properties panel, add the variable WorkflowXMLString in the Content field.
  6. Adicione uma atividade Deserialize XML após a Read Text File.
    • Add the variable WorkflowXMLString in the XMLString field.
    • In the Properties panel, add the value WorkflowXML in the XMLDocument field.
  7. Adicione uma atividade Execute XPath após a atividade Deserialize XML.
    • Add the value WorkflowXML in the Existing XML field.
    • Add the expression "//@InformativeScreenshot" in the XPath Expression field.
    • In the Properties panel, add the variable ScreenshotAttributes in the Result field.
  8. Adicione uma atividade For Each após a atividade Execute XPath.
    • Add the value Attribute in the ForEach field.

    • Add the expression CType(ScreenshotAttributes, IEnumerable).Cast(Of XAttribute) in the Values field.

    • Select the Body container of the activity and create the following variable:

      Nome da variávelTipo de VariávelValor Padrão
      ScreenshotFileExistsBooleano
  9. Add a Log Message activity inside the Body container of the For Each activity.
    • Adicione a expressão "Looking for: " + SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png" no campo Mensagem.
  10. Adicione uma atividade Path Exists após a atividade Log Message.
    • Select the File option from the Path File drop-down list.
    • Add the expression SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png" in the XPath Expression field.
  11. Adicione uma atividade If após a atividade Path Exists.
    • Adicione a expressão Not ScreenshotFileExists no campo Condição.
  12. Add a Log Message activity inside the Then field of the If activity.
    • Select the Warn option from the Level drop-down list.

    • Adicione a expressão String.Format("Could not find the screenshot file {0}.png referenced by file {1}", Attribute.Value, WorkflowFile) no campo Mensagem.

      Imagem dos documentos

  13. Execute o processo. Quando solicitado, selecione a pasta MissingScreenshotSampleProject-ForTestPurposes. O arquivo de fluxo de trabalho de XML na pasta é lido e desserializado. As informações sobre capturas de tela referenciadas no XAML são usadas para identificar e registrar capturas de tela encontradas e ausentes na pasta.

Aqui você pode baixar um exemplo.

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