Validating xml using xsd in c

And then you will need to use qualified names (i.e with a prefix) to refer to a type from the imported schema. Add(null, schema File); Any imports/includes will be done automatically.

As for your C# code, it would suffice to simply add the main schema with e.g. (Validate ok in XML Spy, not c#) I'm not sure how to get a relative import path to work without parsing the and modyfying the import line to give it the hardcoded path required at runtime.

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.

I dont want to use default namespaces, I want my own. I know this is possible and validates ok (in XML Spy). So I think its either a namespace issue or something I may be doing wrong in the validation in c# code. Sample data is a small subset of my real data (cannot post real data). --- XML data --- If you have two schemas with different target namespaces then it does not make sense (in my understanding) to include one schema in the other, rather you need to import the schema with xs:import.

The problem is that surface and atmosphere should allow more than one ingredient. If you approach the validation with dom parser (rather than "sax" as the subject line might suggest), you have to make the builder factory namespace aware.

I gues its some namespace trouble but i dont get it by myself ...I am trying to validate XML data aginst its schemas.There is some sample XML data and related schemas below.Let's see if my file validates against this schema with the messed up Mickey Mantle card entry. VERBOSE: Error: The element 'Card' has invalid child element 'Name'. About the Author Adam Bertram is a 20-year veteran of IT.VERBOSE: Error: The element 'Player' has invalid child element 'Team'. He's an automation engineer, blogger, consultant, freelance writer, Pluralsight course author and content marketing advisor to multiple technology companies.

Leave a Reply