File size: 784 Bytes
d821d28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
param(
    [string]$ProjectRoot = (Join-Path $PSScriptRoot '..'),
    [string]$ManifestPath = (Join-Path $ProjectRoot 'bootstrap.xml'),
    [string]$SchemaPath = (Join-Path $ProjectRoot 'schemas/ProjectOS.xsd')
)

$ErrorActionPreference = 'Stop'
$schemaPath = (Resolve-Path $SchemaPath).Path
$manifestPath = (Resolve-Path $ManifestPath).Path
$schemas = [System.Xml.Schema.XmlSchemaSet]::new()
[void]$schemas.Add($null, $schemaPath)

$settings = [System.Xml.XmlReaderSettings]::new()
$settings.ValidationType = [System.Xml.ValidationType]::Schema
$settings.Schemas = $schemas
$reader = [System.Xml.XmlReader]::Create($manifestPath, $settings)
try {
    while ($reader.Read()) { }
}
finally {
    $reader.Close()
}

Write-Output 'bootstrap.xml validates against schemas/ProjectOS.xsd.'