Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[Catastro WebService Query in PowerShell] Query and process Xml Result for Catastro in PowerShell #xml #PowerShell #webservice
function Consulta_DPNRC($cod_parcela) {
$response = Invoke-WebRequest -UseBasicParsing -Uri "" `
-Method "POST" `
-WebSession $session `
-Headers @{
"Accept-Encoding"="gzip, deflate"
} `
-ContentType "application/x-www-form-urlencoded" `
-Body "Provincia=&Municipio=&RC=$cod_parcela";
$xml = [xml]($response.Content);
$ns = @{"c"=""};
$res = @{
Addr=(($xml | Select-Xml -Namespace $ns -XPath "//c:ldt[1]").Node.InnerText);
Ant=(($xml | Select-Xml -Namespace $ns -XPath "//c:ant[1]").Node.InnerText);
Us=(($xml | Select-Xml -Namespace $ns -XPath "//c:luso[1]").Node.InnerText);
Sup=(($xml | Select-Xml -Namespace $ns -XPath "//c:sfc[1]").Node.InnerText)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment