c# - XML Validation: How to detect if an xsd was specified? -


i validate xml files against internal referenced xsd files using xmlreader following xmlreadersettings:

settings.dtdprocessing = dtdprocessing.ignore; settings.validationtype = validationtype.schema; settings.validationflags |= system.xml.schema.xmlschemavalidationflags.reportvalidationwarnings; settings.validationflags |= system.xml.schema.xmlschemavalidationflags.processinlineschema; settings.validationflags |= system.xml.schema.xmlschemavalidationflags.processschemalocation; 

this works fine long there xsd file referenced. if not validation event handler print error message every element complaining missing schema information. know correct behavior not useful user.

i detect if xsd given , if not, display 1 error message says "no scheme given".

is there simple solution besides error message parsing or hacks that? use xmlreader if possible , not loading whole document beforehand check schema reference. if way, let me know.

my current approach use custom xmlresolver looks xsd files , store properties based on (e.g. there xsd uri resolve, there xsd uris resolved not found , on). works feels bit on top.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -