UiPath Documentation
activities
latest
false
Importante :
Este contenido se ha localizado parcialmente a partir de un sistema de traducción automática. La localización de contenidos recién publicados puede tardar entre una y dos semanas en estar disponible.
UiPath logo, featuring letters U and I in white

Actividades de desarrollador

Última actualización 21 de abr. de 2026

Detectar y analizar un archivo XML

El siguiente ejemplo explica cómo utilizar actividades como Deserializar XML o Ejecutar XPath para deserializar y analizar un archivo XML. Puedes encontrar estas actividades en el paquete UiPath.WebAPI.Activities .

Nota:

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

Así es como se puede construir el proceso de automatización:

  1. Abre Studio y crea un nuevo Proceso.
  2. Arrastra un contenedor Secuencia al Diseñador de flujo de trabajo.
    • Crea las siguientes variables:

      Nombre de la variableTipo de variableValor predeterminado
      SelectedProjectPathCadena
      WorkflowXMLStringCadena
      WorkflowXMLDocumentoX
      ScreenshotAttributesObjeto
  3. Add a Select Folder activity inside the Sequence.
    • In the Properties panel, add the variable SelectedProjectPath in the SelectedFolder field.
  4. Añade una actividad Para cada después de la actividad Seleccionar carpeta.
    • 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. Añade una actividad Deserializar XML después del archivo Leer texto.
    • Add the variable WorkflowXMLString in the XMLString field.
    • In the Properties panel, add the value WorkflowXML in the XMLDocument field.
  7. Añade una actividad Ejecutar XPath después de la actividad Deserializar 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. Añade una actividad Para cada después de la actividad Ejecutar 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:

      Nombre de la variableTipo de variableValor predeterminado
      ScreenshotFileExistsBooleano
  9. Add a Log Message activity inside the Body container of the For Each activity.
    • Agrega la expresión "Looking for: " + SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png" en el campo Mensaje.
  10. Añade una actividad Ruta existente después de la actividad Mensaje de registro.
    • 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. Añade una actividad Si después de la actividad Ruta existente.
    • Añada la expresión Not ScreenshotFileExists en el campo Condición.
  12. Add a Log Message activity inside the Then field of the If activity.
    • Select the Warn option from the Level drop-down list.

    • Agrega la expresión String.Format("Could not find the screenshot file {0}.png referenced by file {1}", Attribute.Value, WorkflowFile) en el campo Mensaje.

      Imagen de documentos

  13. Ejecute el proceso. Cuando se te solicite, selecciona la carpeta MissingScreenshotSampleProject-ForTestPurposes. El archivo de flujo de trabajo XML en la carpeta se lee y deserializa. La información sobre las capturas de pantalla a las que se hace referencia en el XAML se utiliza para identificar y registrar capturas de pantalla encontradas y que faltan en la carpeta.

Aquí puedes descargar un ejemplo.

¿Te ha resultado útil esta página?

Conectar

¿Necesita ayuda? Soporte

¿Quiere aprender? UiPath Academy

¿Tiene alguna pregunta? Foro de UiPath

Manténgase actualizado