i have a little problem and can“t figure out how to resolve it. I am Validating an XDocument against a schema and i get all the nodes which have error. But the Validation process doesnt go deeper after finding an error.
_document.Validate(_schema, (o, e) =>
{
XElement xEle = null;
if (o is XAttribute)
xEle = (o as XAttribute).Parent;
if (o is XElement)
xEle = o as XElement;
if (xEle == null)
{
Debug.WriteLine(o.ToString());
return;
}
_elemtList.Add(o as XElement);
});
My problem is like following
<Car>
<CarName></CarName>
<CarInteriour>
<CarInteriorColor>Red</CarInteriorColor>
</CarInteriour>
</Car>
Lets say this is valid. If i Change the following to
<Car>
<CarInteriour>
<CarInteriorColor></CarInteriorColor>
</CarInteriour>
</Car>
Here is the CarName tag missing and the color Red. I will only get the error for CarName but not color Red. The validation process seems to skip that structure because it did find an error. Is there a way to still keep validating even if there was an error ?