Updated the Markdown manuals

This commit is contained in:
Markus Fleschutz
2023-12-07 20:24:45 +01:00
parent dafa6cf1d7
commit 1ffd91c5e2
605 changed files with 1927 additions and 1015 deletions

View File

@ -6,9 +6,9 @@ This PowerShell script checks the given XML file for validity.
Parameters
----------
```powershell
PS> ./check-xml-file.ps1 [[-file] <String>] [<CommonParameters>]
PS> ./check-xml-file.ps1 [[-path] <String>] [<CommonParameters>]
-file <String>
-path <String>
Specifies the path to the XML file to check
Required? false
@ -25,8 +25,8 @@ PS> ./check-xml-file.ps1 [[-file] <String>] [<CommonParameters>]
Example
-------
```powershell
PS> ./check-xml-file myfile.xml
XML file is valid
PS> ./check-xml-file.ps1 myfile.xml
Valid XML in 'myfile.xml'
```
@ -43,30 +43,29 @@ Script Content
```powershell
<#
.SYNOPSIS
Checks the given XML file for validity
Verifies the given XML file
.DESCRIPTION
This PowerShell script checks the given XML file for validity.
.PARAMETER file
.PARAMETER path
Specifies the path to the XML file to check
.EXAMPLE
PS> ./check-xml-file myfile.xml
✔️ XML file is valid
PS> ./check-xml-file.ps1 myfile.xml
✔️ Valid XML in 'myfile.xml'
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$file = "")
param([string]$path = "")
try {
if ($file -eq "" ) { $file = read-host "Enter path to XML file" }
if ($path -eq "" ) { $path = Read-Host "Enter path to XML file" }
$XmlFile = Get-Item $file
$script:ErrorCount = 0
$XmlFile = Get-Item $path
# Perform the XSD Validation
$script:ErrorCount = 0
$ReaderSettings = New-Object -TypeName System.Xml.XmlReaderSettings
$ReaderSettings.ValidationType = [System.Xml.ValidationType]::Schema
$ReaderSettings.ValidationFlags = [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessInlineSchema -bor [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessSchemaLocation
@ -76,11 +75,10 @@ try {
$Reader.Close()
if ($script:ErrorCount -gt 0) {
write-warning "Invalid XML file"
exit 1
throw "Invalid XML in '$path'"
}
"✔️ XML file is valid"
"✔️ Valid XML in '$path'"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -88,4 +86,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 10/19/2023 08:11:36)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 12/07/2023 20:24:16)*