How to get current node while validate xml document with XSD?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p align=left><font style="background-color:#cce8cf" face=Arial size=2>I am using ValidationEventHandler to validate a XML document with XSD. But I also want to know which node encounters validation error, so that I can also get its value and context. </font><font style="background-color:#cce8cf" face=Arial size=2>In ValidationEventHandler, the argument ValidationEventArgs is quite simple, only provides uesless validation error message/severity. </font><font style="background-color:#cce8cf" face=Arial size=2>I notice that another argument (object sender) has a currentNode property while debugging. </font><font style="background-color:#cce8cf" face=Arial size=2>But when I try to cast it to its type (DocumentSchemaValidator), it is not allowed due to the class (DocumentSchemaValidator) is not accessible. Not sure why this class is designed as a non-accessiable class. Is there any way to get the current node in ValidationEventHandler?</font>
<p align=left><font style="background-color:#cce8cf </font> 
<p align=left><font style="background-color:#cce8cf Appreciate if any ideas. Thanks.</font>

View the full article
 
Back
Top