How do I use PowerShell to Validate XML files against an XSD?
I want to comment that the script in current accepted answer doesn’t validate errors about incorrect orders of elements of xs:sequence. For example: test.xml <addresses xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=’test.xsd’> <address> <street>Baker street 5</street> <name>Joe Tester</name> </address> </addresses> test.xsd <xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema”> <xs:element name=”addresses”> <xs:complexType> <xs:sequence> <xs:element ref=”address” minOccurs=”1″ maxOccurs=”unbounded”/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name=”address”> <xs:complexType> <xs:sequence> <xs:element ref=”name” … Read more