Manipulating an XML file

I need to create a project where I will monitor a directory that will receive XML files. When a file arrives in that directory, I need to read the file and extract some information to put inside a system. However, I didn’t find any activity that does the manipulation of XML files. Is there any on uiPath? If so, could you give instructions for setting up?

Hi @tainan.ramos

You can try use the Newton Soft to deserialize the XML file

Here you can check how to add the package

Regards,

Andres

Hi @tainan.ramos

I hope this helps

  1. you need to change the xml file extension to locked file to read the xml as Text file
    (E.g: test.xml to test.xml.locked)
  2. Read Text file (pass the test.xml.locked) and assign the variable(E.g - XML_TEXT_FILE) to Read Text File
  3. Use the assigned variable in step 2 to Deserialize xml by using “Deserialize XML” Activity and assign variable to “Deserialize XML” (E.g: Input: (XML_TEXT_FILE) and output : Deserialized_XML_Text)
  4. Use the Assigned Variable (Deserialized_XML_Text) in Step 3 to get the XMl contents
    (E.g Deserialized_XML_Text.element(“ParentField”).element(“childfield”).value.tostring

Thanks,
Siva

No need for step 1, you can just use the read text activity and supply it as “test.xml” directly.

@tainan.ramos If you need to make changes to the XML file, UiPath doesn’t really have any built-in activities to do that. You have to use invoke method to make those modifications

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.