concept xml file in category powershell

This is an excerpt from Manning's book Windows PowerShell in Action, Third Edition.
Here’s an example of how this works. You want to take a collection of XML files and rename them as text files. You could write a loop to do the processing, but scriptblock parameters greatly simplify this task. To rename each file, use the Rename-Item cmdlet. This cmdlet takes two parameters: the current filename and the new name. Use a scriptblock parameter as an argument to the -NewName parameter to generate the new filename. This scriptblock will use the -replace operator to replace the .xml file extension with the desired .txt. Here’s the command line that performs this task:
Our previously discussed method for loading an XML file is simple but not too efficient. It requires that you load the file into memory, make a copy of the file while turning it into a single string, and create an XML document representing the entire file using the XML Document Object Model (DOM) representation. The DOM allows you to treat an XML document as a hierarchy of objects, but to do so it consumes a lot of memory.

This is an excerpt from Manning's book PowerShell in Depth, Second Edition.
The first parameter is –ReferenceObject, which is your baseline. To provide the baseline data, use a parenthetical command that imports your baseline data from the XML file. The entire contents of that XML file are converted into objects, and those become the values for the parameter.
PowerShell makes it easy to import an XML file. Now, we’re not talking about the Import-CliXML cmdlet here. That cmdlet is designed to read a specific kind of XML—the kind produced by Export-CliXML. With that particular XML language, PowerShell makes the rules, and the result isn’t meant to be especially human-readable. No, we’re talking about importing any ol’ XML you want, such as the snippet we offered earlier. Just do this: