Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - urgent: validating XML syntax using VC++ [Thread Next] Re: urgent: validating XML syntax using VC++To: NULL Date: 4/2/2007 1:48:00 PM sanoj.varghese@g... wrote: > I have an XML file which needs to be validated using VC++, not against > the schema, BUT AGAINST THE TAGS. I need to check for start <>and end > </>tags to see whether the XML is of proper format or not. How can i > implement this. Can anyone provide some piece of code or ideas leading > to a solution for this problem. If you parse the XML document with an XML parser it will tell whether the XML is well-formed or not as the XML parser reports errors it finds. With C++ you can use MSXML, any MSXML version (e.g. MSXML 3 or MSXML 6 can do well-formedness checks), see the MSXML SDK <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/b24aafc2-bf1b-4702-bf1c-b7ae3597eb0c.asp> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/14e70ac1-b724-498e-b6e1-7e3e1ae7bb6e.asp> you simply need to call the load method of a DOMDocument and check the parseError.errorCode property. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
