Skip to content
Back to skills

Powershell Xml Processing

ASecurity

Use when processing XML data in PowerShell.

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 10, 2026
ai-agentsgoshellnode

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add LoopyLuci/Skills --skill powershell-xml-processing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Powershell Xml Processing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Powershell Xml Processing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/loopyluci-powershell-xml-processing/badge)](https://www.skillsdirectory.com/skills/loopyluci-powershell-xml-processing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: powershell-xml-processing
description: "Use when processing XML data in PowerShell."
category: software-development
tags: [powershell, xml, parsing, xpath, config]
---
# PowerShell XML Processing

Working with XML data in PowerShell.

## Loading XML

```powershell
# From file
$xml = [xml](Get-Content "config.xml" -Raw)

# From string
$xml = [xml]'<root><item id="1">Value</item></root>'

# From web
$xml = [xml](Invoke-WebRequest -Uri "https://example.com/data.xml").Content
```

## Navigation

```powershell
$xml = [xml]@"
<project>
  <name>MyApp</name>
  <version>1.0.0</version>
  <dependencies>
    <dep id="boost" version="1.84" />
    <dep id="vulkan" version="1.3" />
  </dependencies>
</project>
"@

# Dot-notation
$xml.project.name           # MyApp
$xml.project.dependencies.dep[0].id  # boost

# XPath
$xml.SelectSingleNode("//dep[@id='vulkan']").version
$xml.SelectNodes("//dep") | ForEach-Object { $_.id }
```

## Modifying XML

```powershell
# Add element
$newDep = $xml.CreateElement("dep")
$newDep.SetAttribute("id", "fmt")
$newDep.SetAttribute("version", "10")
$xml.project.dependencies.AppendChild($newDep)

# Modify attribute
$dep = $xml.SelectSingleNode("//dep[@id='boost']")
$dep.SetAttribute("version", "1.85")

# Remove element
$dep = $xml.SelectSingleNode("//dep[@id='vulkan']")
$xml.project.dependencies.RemoveChild($dep)

# Save
$xml.Save("config.xml")
```

## Working with CSProj / .config Files

```powershell
# Read .csproj
$csproj = [xml](Get-Content "MyProject.csproj" -Raw)
$csproj.Project.PropertyGroup | Select-Object TargetFramework, Platform

# Read app.config
$config = [xml](Get-Content "app.config" -Raw)
$config.configuration.connectionStrings.add.connectionString

# Read .vcxproj
$vcxproj = [xml](Get-Content "project.vcxproj" -Raw)
$ns = @{ ns = "http://schemas.microsoft.com/developer/msbuild/2003" }
$vcxproj.SelectNodes("//ns:ClCompile", $ns) | ForEach-Object { $_.Include }
```

## Pitfalls

- **[xml] type accelerator** requires well-formed XML -- wrap in try/catch
- **Namespaces** need explicit handling with SelectSingleNode/SelectNodes
- **XML preserving** -- [xml] parser may reformat whitespace; use XmlWriter for control
- **Large XML** can be memory-intensive -- use XmlReader for streaming (>100MB)
- **Special chars** -- XML &, <, >, ' " need encoding or CDATA sections

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.