I am trying to extract data from an xml file which contains multiple namspaces. I used xmlns value in the element function but error is throwing saying that “Object reference not set to an instance of an object.”
ppr
(Peter Preuss)
February 17, 2021, 12:37pm
2
@Soumalya_Mondal
have a look here:
@mahmoud.zaky
find starter help (show casing dedicated access and loop over the result element) here:
XMLDemo.xaml (6.7 KB)
in case of retrieval issues following trick helps to find out the needed things:
[grafik]
xDoc.Root.Descendants()(X).Name - play with X=index and find out the needed namespace for a particular element
@Zlotzky
Setting up the quick prototype:
Variables:
Handling Namespace:
[grafik]
ElementNames to Extract - Prototype reduced set:
[grafik]
Read In XML
[grafik]
Ensure:
[grafik]
Retrieval of private contact element (mandatory use of the Namespace within the name)
[grafik]
iterating over the list of elmentnames (ExtractNames) and reading element value:
[grafik]
Logs:
[grafik]
Find starter help here:
Zlotzky.xaml (6.3 KB)
@Fabian_DDD
I do feel that a XPath Approach is better for the retrieval
Setting up a NamespaceManager with a Config Datatable:
[grafik]
for the default namespace with empty prefix “def” is assigne as prefix
the retrieval is configured as another datatable (could also be externalize into an excel)
[grafik]
I did also for a deeper nested element for demo purpose
After all preperation it is iterating over the retrieval config and retrieves the specfied values. et voila:
[grafik]
So this …