1

I have huge list of XML files (over 100 000) and wanted to access specific node value in each of them using powershell. Issue I'm having is that all of them have namespaces that take you nowhere. Do you know what would be the best way to ignore it?

2
  • use xpath to find a specific node Commented May 16, 2019 at 8:32
  • Select-Xml is your friend. Commented May 16, 2019 at 8:58

1 Answer 1

3
[xml]$xml = Get-Content file.xml

Then access $xml as a PowerShell object (e.g. $xml.some.node).

Sign up to request clarification or add additional context in comments.

3 Comments

This does not answer OPs question regarding namespaces.
@montonero It does answer the question, since dot-accessing the XML data structure ignores namespaces.
In my case I found that $xml was empty if file.xml had namespaces or maybe xsd references that could not be resolved. So there is that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.