XML Document Depth?


How to find the depth of the xml file using powershell/xpath?

consider the below xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
  <title>Harry Potter</title>
  <title>Learning XML</title>

depth of the above xml document is 3 (bookstore -> book -> title/price).


Something like


should find the max depth. But your Parser must support XPath 2.0.

By : DrDol

Don't think you can do this with XPath but you could try this instead:

$xml = [xml]"

This video can help you solving your question :)
By: admin