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

4x4 Matrix in Python -

python - String indices must be integers and while issue -

wso2is - WSO2 IS 5.0.0 SP1 After restart there is authentication error -