Validating xml against xsd c

I have a XML and a Schema for the same What I want is when its validated against the schema, it should give custom errors saying what happened and where...... Right now the validation works but the error returning our very vague, I need a way where I can customize the error or at least let the user know where the error is at what element and which attribute.

thanks, Shailendra Batham What language do you use?

One reason could be that you plugged a Handler Base as Error Handler, and that will throw an exception only in presence of a fatal error (validation errors as hence ignored).

If you want to see them, derive your own class from it and handle the error() method.

An error occurred at , (2, 9)." string can we do custom errors like what node's attribute had an error. Schema Validation Event Handler Validation Event Args Xml Text Reader xmlreader = new Xml Text Reader("test.xml"); Xml Validating Reader valid = new Xml Validating Reader(xmlreader); valid. I have a XML and a Schema for the same What I want is when its validated against the schema, it should give custom errors saying what happened and where...... Right now the validation works but the error returning our very vague, I need a way where I can customize the error or at least let the user know where the error is at what element and which attribute.

"Chua Wen Ching" Hi Shailendra, If you are coding in .

I would suggest you try running the SAX2Print sample application in the debugger and see what that code does.

#include "stdio.h" #import using namespace MSXML2; int check Parse Error(IXMLDOMParse Error Ptr p Error); void dump_com_error(_com_error &e); int main(int argc, char* argv[]) int check Parse Error(IXMLDOMParse Error Ptr p Error) void dump_com_error(_com_error &e) Input file: wrote in message news: OA**************@TK2MSFTNGP11gbl...

thanks, Shailendra Batham Hi Shailendra, If you are coding in . thanks, Shailendra Batham Thanks for the reply guys.

hey chua I am using C# and I am using the Validation Event Handler, it works fine but this is what error it returns "The 'ID' attribute has an invalid value according to its data type. "Shailendra Batham" wrote: hi guys I need your suggestions / opinion for doing this the right way. if the Attribute is missing or invalid in the following element then it should say ID attribute invalid for "Watch" Element.

There is some sample XML data and related schemas below.

I have looked at many posts to see how to use the XML validating reader (Now just XMLReader. The data validates 100% using XML Spy from Altova but not using the XMLReader in C#. The error that occurs trying to find the type String20, which is my first custom data type in my schema.

Search for validating xml against xsd c:

validating xml against xsd c-27

hi guys I need your suggestions / opinion for doing this the right way. if the Attribute is missing or invalid in the following element then it should say ID attribute invalid for "Watch" Element. "Shailendra Batham" wrote: hi guys I need your suggestions / opinion for doing this the right way. if the Attribute is missing or invalid in the following element then it should say ID attribute invalid for "Watch" Element.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “validating xml against xsd c”