c# - Validate XML element against schema -


i need validate small fragment of xml file against schema. essentially, i'd ask question "does element x in xml document y conform type defined in schema z?" , if not message describing why. has account restrictions placed on types (e.g. maxlength, mininclusive).

is possible?

i don't know doing c#, it's done in xquery or xslt 2.0. in xslt 2.0 it's:

<xsl:copy-of select="doc('doc.xml')//selected/element" validation="strict"/> 

and in xquery it's

validate strict {doc('doc.xml')//selected/element} 

all need schema-aware xquery or xslt 2.0 processor runs in chosen environment.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -