XML commands
Extensible Markup Language (XML) is a plain text format that is used to store structured data. XML is written to be both human and machine readable.
PowerShell includes Select-Xml
and ConvertTo-Xml
commands to work with XML content.
Before exploring the commands, let's look at the basic structure of XML documents.
About XML
XML documents often begin with a declaration, as shown here:
<?xml version="1.0" encoding="utf-8"?>
This declaration has three possible attributes. The version attribute is mandatory when a declaration is included:
version
: The XML version,1.0
or1.1
encoding
: The file encoding, most frequentlyutf-8
orutf-16
standalone
: Whether the XML file uses an internal or external Document Type Definition (DTD); permissible values areyes
orno
The use of the standalone directive with DTD is beyond the scope of this chapter.
Elements and attributes
XML is similar...