UiPath Documentation
activities
latest
false
Wichtig :
Bitte beachten Sie, dass dieser Inhalt teilweise mithilfe von maschineller Übersetzung lokalisiert wurde. Es kann 1–2 Wochen dauern, bis die Lokalisierung neu veröffentlichter Inhalte verfügbar ist.

Entwickleraktivitäten

Letzte Aktualisierung 21. Apr. 2026

Eine XML-Datei erkennen und analysieren

Im folgenden Beispiel wird erläutert, wie Aktivitäten wie Deserialize XML oder Execute XPath zum Deserialisieren und Analysieren einer XML-Datei verwendet werden. Diese Aktivitäten finden Sie im Paket UiPath.WebAPI.Activities .

Hinweis:

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

So kann der Automatisierungsprozess erstellt werden:

  1. Öffnen Sie Studio und erstellen Sie einen neuen Prozess.
  2. Ziehen Sie einen Sequence-Container in den Workflow-Designer.
    • Erstellen Sie die folgenden Variablen:

      VariablennameVariablentypStandardwert
      SelectedProjectPathString
      WorkflowXMLStringString
      WorkflowXMLXDokument
      ScreenshotAttributesObjekt
  3. Add a Select Folder activity inside the Sequence.
    • In the Properties panel, add the variable SelectedProjectPath in the SelectedFolder field.
  4. Fügen Sie eine For Each-Aktivität nach der Select Folder-Aktivität hinzu.
    • 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. Fügen Sie die Aktivität Deserialize XML nach der Read Text File hinzu.
    • Add the variable WorkflowXMLString in the XMLString field.
    • In the Properties panel, add the value WorkflowXML in the XMLDocument field.
  7. Fügen Sie eine Execute XPath-Aktivität nach der Aktivität Deserialize XML hinzu.
    • 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. Fügen Sie eine For Each-Aktivität nach der Aktivität Execute XPath hinzu.
    • 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:

      VariablennameVariablentypStandardwert
      ScreenshotFileExistsBoolescher
  9. Add a Log Message activity inside the Body container of the For Each activity.
    • Fügen Sie den Ausdruck "Looking for: " + SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png" in das Feld Nachricht ein.
  10. Fügen Sie eine Path Exists-Aktivität nach der Log Message-Aktivität hinzu.
    • 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. Fügen Sie eine If-Aktivität nach der Aktivität Path Exists hinzu.
    • Fügen Sie den Ausdruck Not ScreenshotFileExists in das Feld Bedingung ein.
  12. Add a Log Message activity inside the Then field of the If activity.
    • Select the Warn option from the Level drop-down list.

    • Fügen Sie den Ausdruck String.Format("Could not find the screenshot file {0}.png referenced by file {1}", Attribute.Value, WorkflowFile) in das Feld Nachricht ein.

  13. Führen Sie den Prozess aus. Wenn Sie dazu aufgefordert werden, wählen Sie den Ordner MissingScreenshotSampleProject-ForTestPurposes aus. Die XML-Workflow-Datei im Ordner wird gelesen und deserialisiert. Informationen zu Screenshots, auf die in der XAML verwiesen wird, werden verwendet, um gefundene und fehlende Screenshots im Ordner zu identifizieren und zu protokollieren.

Hier können Sie ein Beispiel herunterladen.

War diese Seite hilfreich?

Verbinden

Benötigen Sie Hilfe? Support

Möchten Sie lernen? UiPath Academy

Haben Sie Fragen? UiPath-Forum

Auf dem neuesten Stand bleiben