Need help to extract XML attribute values using UiPath Activity

I have the XML file. Through UiPath i wish to export attribute values using System.XML.LinQ
The reason i am uploading here is because despite Youtube videos and help i could not extract the values. Sharing the XML here.

please help me with UiPath Sequence to extact values from XML:

  1. DisplayName
  2. Attribute under Shortcut.
  3. FileTypeAssociations value whether its true or false.

please use </> format button from Editor or better share the XML as Text file with us

<DeploymentConfiguration DisplayName=“Morningstar_DirectWithExcelAddIn_3.20.029_x86_APV50386_v1.0”






[{Common Programs}]\Morningstar Direct\Microsoft Excel with Morningstar 3.20.029.lnk
[{System}]\wscript.exe

        </Shortcut>
      </Extension>
      <Extension Category="AppV.Shortcut">
        <Shortcut>
          <File>[{Common Programs}]\Morningstar Direct\Morningstar Direct v3.20.029.lnk</File>
          <Target>[{ProgramFilesX86}]\Morningstar\Direct\MStarAWD.exe</Target>
          
        </Shortcut>
      </Extension>
    </Extensions>
  </Shortcuts>
  
  
  <FileTypeAssociations Enabled="true">
  </FileTypeAssociations>
  
  
  <COM Mode="Isolated">
    <IntegratedCOMAttributes OutOfProcessEnabled="true" InProcessEnabled="false" />
  </COM>

as mentioned, better to share the XML as Text file. We do see an incomplete snippet which will be invalid XML

As a Preview:
grafik
out: xDoc | XDocument

Retrievals:
grafik

And also:
grafik

<DeploymentConfiguration






[{System}]\wscript.exe



  <FileTypeAssociations Enabled="true">
  </FileTypeAssociations>
</Subsystems>

need to find Target. value

@Manish_Bedi
please share your XML snippets best by a Text file or use properly the </> format button from editor

So we can avoid ping-pongs and can help faster on the individual details. Thanks for support

The AppV.Shortcut is not working for me

was shown based on our sample XML due you did not share properly a XML and we worked on a demo sample (structure was already shown)

Kindly note:

XML.xml (17.2 KB)

Need

  1. DisplayName
  1. File Value at Line 56
  2. FileType Associations Enabled value at line 85
  3. Mode Value at line 253
    Regards

from the given XML we can now derive some more details as e.g. namespaces are to handle:
grafik

We will have a closer look on it. In the meanwhile you can checkout the following:
XML Extraction - Handling Namespaces (Tableau, Soap, OASIS types) - Help / Community - UiPath Community Forum

Deserialization - xDoc
Handling Document Namespace - xnsDefault
xDoc.Root.Name.Namespace

grafik

Retrievals:
grafik

Code Snippets
 xdoc.Root.Name
 [{http://schemas.microsoft.com/appv/2010/deploymentconfiguration}DeploymentConfiguration]
 xDoc.Root.Descendants(xnsDefault + "File").First().Value
 "[{Common Programs}]\Morningstar Direct\Microsoft Excel with Morningstar 3.20.029.lnk"
 xDoc.Root.Descendants(xnsDefault + "FileTypeAssociations").First().Attribute("Enabled").Value
 "true"
 xDoc.Root.Descendants(xnsDefault + "COM").First().Attribute("Mode").Value
 "Isolated"
 xDoc.Root.Attribute("DisplayName").Value
 "Morningstar_DirectWithExcelAddIn_3.20.029_x86_APV50386_v1.0" xdoc.Root.Name
 [{http://schemas.microsoft.com/appv/2010/deploymentconfiguration}DeploymentConfiguration]
 xDoc.Root.Descendants(xnsDefault + "File").First().Value
 "[{Common Programs}]\Morningstar Direct\Microsoft Excel with Morningstar 3.20.029.lnk"
 xDoc.Root.Descendants(xnsDefault + "FileTypeAssociations").First().Attribute("Enabled").Value
 "true"
 xDoc.Root.Descendants(xnsDefault + "COM").First().Attribute("Mode").Value
 "Isolated"
 xDoc.Root.Attribute("DisplayName").Value
 "Morningstar_DirectWithExcelAddIn_3.20.029_x86_APV50386_v1.0"

RnD was done within the immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Please can you share your XAML file. as i am unable to set xnsDefault when trying

XAML will not be compatible with your end.

xnsDefault handling is already described within the linked ressource
grafik
datatype: System.Xml.Linq.XNamespae

One last question, if i want to search whether a string “Cactus” is present in XML or not. and output be in true or false, how to handled it please.

Thank you Peter. this has worked so far.

Regards

we prefer to scope 1 case = 1 Topic. So other researchers can find faster solutions for their similar use cases

So close the topic by
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

Preview on about:

it is not defining sharp enough the requirement: Element name, attribute name, values?

Just put your answer within your new created topic