How can I check if a xml file is well formed without invalid chars or tags?
For example, consider this xml:
<?xml version="1.0"?>
<PARTS>
<TITLE>Computer Parts</TITLE>
<PART>
<ITEM>Motherboard</ITEM>
<MANUFACTURER>ASUS</MANUFACTURER>
<MODEL>P3B-F</MODEL>
<COST> 123.00</COST>
</PART>
<PART>
<ITEM>Video Card</ITEM>
<MANUFACTURER>ATI</MANUFACTURER>
<MODEL>All-in-Wonder Pro</MODEL>
<COST> 160.00</COST>
</PART>
</PARTSx>
The last tag </PARTSx>must be </PARTS>
You can use the
IXMLDOMParseErrorinterface returned by theMSXML DOMDocumentthis interface return a serie of properties which help you to identify the problem.
check these two functions which uses the MSXML 6.0 (you can use another versions as well)