Test Xml Schema
Last Modified: February 25, 2024 18:18 CEST

Test-XmlSchema #

SYNOPSIS #

Tests an xml schema against an xml file

SYNTAX #

Test-XmlSchema [[-xmlFile] <String>] [[-schemaFile] <String>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION #

Tests whether an XML file conforms to its schema.

EXAMPLES #

Example 1:Tests if the xml file is valid against the specified schema #

PS C:\> if (Test-XmlSchema -xmlFile 'C:\temp\article.xml' -schemaFile 'C:\temp\article.xsd' ) { Write-Host 'XML file is valid' } else { 'XML file is not valid' }

This can be used to test whether the XML file corresponds to the specified schema.

PARAMETERS #

-schemaFile #

Name incl. path to the xsd schema file.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-xmlFile #

Name incl. path to the xml file.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters #

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS #

System.String #

OUTPUTS #

System.Object #

NOTES #