I am trying to validate a XML instance with a XML Schema which contains an assert
tag in it. The validator throws an exception containing the message:
The content of '#AnonType_message' is invalid. Element 'assert' is invalid, misplaced, or occurs too often.
This is my code:
//xmlData is a xml string
Source xmlFile = new StreamSource(new StringReader( xmlData ));
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(schemaFile);
Validator validator = schema.newValidator();
validator.validate(xmlFile);
This is the parser's error message:
org.xml.sax.SAXParseException