UiPath Documentation
activities
latest
false

Actividades de desarrollador

Última actualización 21 de abr. de 2026

Ejecutar XPath

UiPath.WebAPI.Activities.ExecuteXPath

Ejecuta la expresión XPath especificada en un documento XML determinado. Para obtener más información sobre la sintaxis XPath, ve aquí.

Propiedades

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.
Otros
  • Privado : si se selecciona, los valores de variables y argumentos ya no se registran en el nivel Detallado.
Común
  • Nombre para mostrar: el nombre para mostrar de la actividad.
Salida
  • Result - An Object variable containing the retrieved nodes or node-sets of the given XML. This field supports only Object variables.

Ejemplo de uso de la actividad Ejecutar 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.

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

  1. Abre Studio y crea un nuevo Proceso.
    Nota:

    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.
    • Crea las siguientes variables:

      Nombre de la variableTipo de variableValor predeterminado
      XMLStringCadena
      ResultObjeto
  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. Añade una actividad Ejecutar XPath después de la actividad Leer archivo de texto.
    • 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.
    • Agrega la variable Result en el campo Resultado.
  5. Arrastra una actividad Escribir línea después de la actividad Ejecutar XPath.
    • Añada la expresión "Result: " + Result.ToString en el 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.
  • Propiedades
  • Ejemplo de uso de la actividad Ejecutar XPath

¿Te ha resultado útil esta página?

Conectar

¿Necesita ayuda? Soporte

¿Quiere aprender? UiPath Academy

¿Tiene alguna pregunta? Foro de UiPath

Manténgase actualizado