XML Validation - multiple errors & line numbers

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I can validate an xml file against a schema using one of 2 methods:
1) Create an XmlReader and use the .Validate method
2) Create an XmlReader and loop around whilst performing a .Read method.
They both work, but in different ways. With method 1) I get one error and can identify which line it is and where on that line it occurred by using the XmlSchemaValidationException. With method 2) I get all the errors, but I dont get line numbers or useful
stuff like that as no XmlSchemaValidationException are raised, I have to use XmlSchemaException.
I basically want to combine the functionality of both methods, i.e. I want to be able to list all the errors and identify where they are by line and position. Ill accept just line if necessary...
Cheers,

Rob




View the full article
 
Back
Top