use of com.intellij.xml.actions.validate.TestErrorReporter in project intellij-community by JetBrains.
the class XmlConstraintsTest method getXSModel.
private XSModel getXSModel(String... files) {
myFixture.configureByFiles(files);
XmlFile file = (XmlFile) myFixture.getFile();
ValidateXmlActionHandler handler = new ValidateXmlActionHandler(false) {
@Override
protected SAXParser createParser() throws SAXException, ParserConfigurationException {
SAXParser parser = super.createParser();
parser.getXMLReader().setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE, true);
return parser;
}
};
handler.setErrorReporter(new TestErrorReporter(handler));
handler.doValidate(file);
XMLGrammarPool grammarPool = ValidateXmlActionHandler.getGrammarPool(file);
assert grammarPool != null;
Grammar[] grammars = grammarPool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
XSGrammar grammar = (XSGrammar) grammars[0];
return grammar.toXSModel();
}
Aggregations