Click here to Skip to main content
15,743,541 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Team, please help me how can I validate following xml format using PowerShell. See the forth line don't have "<".


suppose I save the above content in c:\temp\test.xml. And when I run following code it did not show any error.

$xmlfile = c:\temp\test.xml
$xml = New-Object System.Xml.XmlDocument

My question is how can I produce the error without xsd.
should produce error.

What I have tried:

I tried XmlDocument.Load Method but it did not show any error.
Updated 7-May-20 17:33pm
F-ES Sitecore 7-May-20 12:02pm    
What do you mean by "validate"? The XML is invalid, the error you get when calling Load tells you that, so there is your answer.
mkumar2511 7-May-20 23:09pm    
No it is not showing any error when call Load method. And that is the issue.

1 solution

Quite a few suggestions: powershell validate xml - Google Search[^].
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900