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:
DisplayName
Attribute under Shortcut.
FileTypeAssociations value whether its true or false.
ppr
(Peter Preuss)
August 9, 2024, 8:20am
3
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>
ppr
(Peter Preuss)
August 9, 2024, 9:50am
5
as mentioned, better to share the XML as Text file. We do see an incomplete snippet which will be invalid XML
As a Preview:
out: xDoc | XDocument
Retrievals:
And also:
<DeploymentConfiguration
[{System}]\wscript.exe
<FileTypeAssociations Enabled="true">
</FileTypeAssociations>
</Subsystems>
need to find Target. value
ppr
(Peter Preuss)
August 12, 2024, 12:10pm
8
@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
ppr
(Peter Preuss)
August 12, 2024, 12:13pm
10
ppr:
As a Preview:
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:
ppr
(Peter Preuss)
August 12, 2024, 1:09pm
12
from the given XML we can now derive some more details as e.g. namespaces are to handle:
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
ppr
(Peter Preuss)
August 12, 2024, 1:18pm
13
Deserialization - xDoc
Handling Document Namespace - xnsDefault
xDoc.Root.Name.Namespace
Retrievals:
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
ppr
(Peter Preuss)
August 12, 2024, 1:30pm
15
XAML will not be compatible with your end.
xnsDefault handling is already described within the linked ressource
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
ppr
(Peter Preuss)
August 12, 2024, 1:59pm
17
we prefer to scope 1 case = 1 Topic. So other researchers can find faster solutions for their similar use cases
Manish_Bedi:
this has worked so far.
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