< Back

Test-Xml

Tue Jan 14, 2020 3:18 am

NAME Test-Xml



SYNOPSIS

The Test-Xml cmdlet test an XML File for errors.





SYNTAX

Test-Xml [-Path] <String> [-ExtendedProperties] [<CommonParameters>]





DESCRIPTION

You should give the path to the XML file as an input an the cmdlet response with an object with next properties:

Path: The full path to the given XML file to test.

ValidXmlFile: A boolean value indication if it is a valid XML file.

Error: Description of the error in case it exists.





PARAMETERS

-Path <String>



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-ExtendedProperties [<SwitchParameter>]



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Test-Xml -Path "c:\\temp\\myxmlfile.xml"



Test the file: "c:\\temp\\myxmlfile.xml"









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Test-Xml -FullName "c:\\temp\\myxmlfile.xml"



Test the file: "c:\\temp\\myxmlfile.xml"









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Test-Xml "c:\\temp\\myxmlfile.xml"



Test the file: "c:\\temp\\myxmlfile.xml"









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-ChildItem -Path "C:\\temp\\" -Filter "*.xml" | ForEach-Object { Test-Xml $_.FullName }



Test all xml files with an .xml extension in path: "c:\\temp\\"











RELATED LINKS

https://github.com/josuemb/HumanTechSol ... l.XmlUtils