Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FindXPath([System.Xml.XmlNode]$node) {
- [string]$cur = ''
- if($node -ne $null){
- if($node.NodeType -eq [System.Xml.XmlNodeType]::Attribute) {
- $cur = "/@[$($node.Name)]"
- } elseif($node.NodeType -eq [System.Xml.XmlNodeType]::Element) {
- $cur = "/$($node.Name)"
- } elseif($node.NodeType -eq [System.Xml.XmlNodeType]::Document) {
- $cur = ""
- } else {
- $cur = "Not Supported"
- }
- $cur = "$(FindXPath($node.ParentNode))$($cur)"
- }
- return $cur
- }
- [xml]$xml = Get-Content $xmlfile
- $nodes = $xml.SelectNodes("//Guid")
- $nodes | % { FindXPath $_ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement