Data extraction from XML file

Hi, I’m trying to extract data from XML tags using .Element but i recive the message “Message Box: Object reference not set to an instance of an object.”

I’m using this xml file just for test.

The entire string: outputXML.Element(“component”).Element(“header”).Element(“publicationMeta”).Element(“publisherInfo”).Element(“publisherName”).Value

HI @guilherme.dias

Have a look on the document


unfortunately we can not refer to the XML as we cannot see it (Have a look on your psot above)

Often extraction fails due to the XML is defining namespaces.

Have a look below on how to check and to handle such a case

Otherwise share some sample XML with us for our further assistance

Hi Peter, yes, i do have to handle with namespaces. Looks like that your resolution can solve my problems, but i didn’t understood the last part. How can i use a variable into .descendants?

I can not attach any file because i’m a new user :frowning:

just use the editor </> format button and share the relevan snippet with us

The xml file

shared xml is not containing an element with name publisherName

simulated on shared XML with xNome:


Sorry about the file, i’ve changed the file in the middle of the project to see if the error was in the file.

Thank you for the support, i’'ve understand how it works and the extraction worked well

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