this xml file
<?xml version="1.0" encoding="utf-8"?>
<root>
<a>Only Text</a>
<a>
<b>Child node</b>
</a>
<a>
<b>Child node</b>
Mixed content
</a>
</root>
and this xsd file
<?xml version="1.0" encoding="UTF-8"?>
<iso:schema xmlns:iso="http://purl.oclc.org/dsdl/schematron">
<iso:pattern id="children tests">
<iso:rule context="a">
<iso:assert test="empty(child::node())">
Element has nodes
</iso:assert>
<iso:assert test="empty(child::*)">
Element has child elements
</iso:assert>
<iso:assert test="empty(child::text())">
Element has text
</iso:assert>
<iso:report test="child::text() and empty(child::*)">
Element has only text
</iso:report>
</iso:rule>
</iso:pattern>
</iso:schema>
and this code
Validator validator = new Validator();
//validator.XmlSchemas.Add("", @"C:\project\Schematron\ConsoleApplication2\shematron\pdfdogschematron.sch");
validator.AddSchema(@"C:\project\Schematron\ConsoleApplication2\shematron\book.xsd");
IXPathNavigable a = validator.Validate(new XmlTextReader(@"C:\project\Schematron\ConsoleApplication2\shematron\dog.xml"));
I am using NMatrix.Schematron validator but it's not correctly.The method don't exception always.