scripts

Resolve-XPath.ps1

SYNOPSIS

Returns the XPath of the location of an XML node.

SYNTAX

Resolve-XPath.ps1 [-XmlNode] <XmlNode> [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

EXAMPLES

EXAMPLE 1

<b c="value"/></a>' |Select-Xml //@c |Resolve-Xml.ps1

/a/b/@c

EXAMPLE 2

one<!-- two -->three</a>' |Select-Xml '//text()' |Resolve-XPath.ps1

/a/text()[1] /a/text()[2]

PARAMETERS

-XmlNode

An XML node to retrieve the XPath for.

Type: XmlNode
Parameter Sets: (All)
Aliases: Node

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-ProgressAction

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Xml.XmlNode or property of that type named XmlNode or Node.

OUTPUTS

System.Management.Automation.PSCustomObject with the following properties:

* XPath: The XPath that locates the node.

* Namespace: The namespace table used to select the node.

NOTES

https://docs.microsoft.com/dotnet/api/system.xml.xmlnode