Validating xml fragments schemas
Add(" Service_WEB", " Service_WEB/VASProvider XMLSchema.xsd") 'set XMLReader settings Dim XMLData Reader Settings As Xml Reader Settings = New Xml Reader Settings() XMLData Reader Settings.
__________________________________________________ Sincerely, Young Fang Microsoft Online Community Support Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
Works for me - your mileage may vary :-) Xml Schema schema; using (Memory Stream stream = new Memory Stream()) using (File Stream fs = new File Stream("My Schema.xsd", File Mode. Create(fs)) Xml Document doc = new Xml Document(); doc. It doesn't not seem possible to do what I aspire to do.
My current work around is to create a blank template xml document. From there, I believe the Validate method would then be viable. The problem is that only root elements can be validated. I edit the scheme IN MEMORY and add the element/type to validate to the root Just a couple of lines and you must not modify or add any XSD files :) With this simple change to your in-memory schema, you can validate the fragment with the same code you use to validate a full document.
In this particular case your local element declaration has no dependencies on other schema components, and there are no namespaces involved so you could extract it textually to form a new schema as others have suggested. The schema wasn't designed to be used the way you are trying to use it.
I'm trying to validate the following xml fragment (Figure A.) against a schema document (Figure B.) that i have created and tested through a seperate XML Validator utility that so i know that the validation works outside of the code (Figure C.). This can be beneficial to other community members reading the thread.
Dim xml Frag As String = XMLData 'Add the schema to Xml Schema Set Dim XMLData Schema As Xml Schema Set = New Xml Schema Set XMLData Schema.
I've tried just about everything :( ========================= A.
XML Fragment to Validate ========================= ==================================== C.
If you want to keep an older version, however still want plugin manager, you can get it on github, and install it by extracting the archive and copying contents to plugins and updates folder.
Visual Studio, when I open the file, validates it against the schema and lists errors perfectly.