October 2017
Intermediate to advanced
440 pages
11h 47m
English
XML documents that reference a schema can be validated.
PowerShell itself comes with a number of XML files with associated schemas in the help files. For example, the help file for ISE is available:
PS>Get-Item $pshome\modules\ISE\en-US\ISE-help.xml
Directory: C:\Windows\System32\WindowsPowerShell\v1.0\modules\ISE\en-US
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 29/11/16 07:57 33969 ISE-help.xml
The schema documents used by the help content are saved in $pshome\Schemas\PSMaml.
The following snippet may be used to load the schema files and then test the content of the document:
$path = Resolve-Path "$pshome\modules\ISE\en-US\*-help.xml" [Xml]$document = Get-Content $path -Raw $document.Schemas.Add( ...
Read now
Unlock full access