Search in sources :

Example 1 with Validator

use of org.eclipse.wst.xml.core.internal.validation.eclipse.Validator in project webtools.sourceediting by eclipse.

the class JSPContentValidator method validate.

private void validate(IFile file, int kind, ValidationState state, IProgressMonitor monitor, IDOMModel model, IReporter reporter) {
    IDOMDocument document = model.getDocument();
    if (document == null)
        // error
        return;
    boolean isXMLJSP = isXMLJSP(document);
    boolean hasHTMLFeature = hasHTMLFeature(document);
    if (hasHTMLFeature && !isXMLJSP) {
        INodeAdapterFactory factory = HTMLValidationAdapterFactory.getInstance();
        ValidationAdapter adapter = (ValidationAdapter) factory.adapt(document);
        if (adapter != null) {
            HTMLValidationReporter rep = getReporter(reporter, file, model);
            rep.clear();
            adapter.setReporter(rep);
            adapter.validate(document);
        }
    }
    if (!hasHTMLFeature && isXMLJSP) {
        Validator xmlValidator = new Validator();
        xmlValidator.validate(file, kind, state, monitor);
    }
}
Also used : ValidationAdapter(org.eclipse.wst.sse.core.internal.validate.ValidationAdapter) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument) Validator(org.eclipse.wst.xml.core.internal.validation.eclipse.Validator) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Aggregations

INodeAdapterFactory (org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)1 ValidationAdapter (org.eclipse.wst.sse.core.internal.validate.ValidationAdapter)1 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)1 Validator (org.eclipse.wst.xml.core.internal.validation.eclipse.Validator)1