Search in sources :

Example 1 with XMLValidationReport

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

the class Validator method validate.

public ValidationReport validate(String uri, InputStream inputstream, NestedValidatorContext context, ValidationResult result) {
    XMLValidator validator = XMLValidator.getInstance();
    XMLValidationConfiguration configuration = new XMLValidationConfiguration();
    try {
        // Preferences pluginPreferences = XMLCorePlugin.getDefault().getPluginPreferences();
        configuration.setFeature(XMLValidationConfiguration.INDICATE_NO_GRAMMAR, indicateNoGrammar);
        final IPreferencesService preferencesService = Platform.getPreferencesService();
        configuration.setFeature(XMLValidationConfiguration.INDICATE_NO_DOCUMENT_ELEMENT, preferencesService.getInt(XMLCorePlugin.getDefault().getBundle().getSymbolicName(), XMLCorePreferenceNames.INDICATE_NO_DOCUMENT_ELEMENT, -1, fPreferenceScopes));
        configuration.setFeature(XMLValidationConfiguration.USE_XINCLUDE, preferencesService.getBoolean(XMLCorePlugin.getDefault().getBundle().getSymbolicName(), XMLCorePreferenceNames.USE_XINCLUDE, false, fPreferenceScopes));
        configuration.setFeature(XMLValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, preferencesService.getBoolean(XMLCorePlugin.getDefault().getBundle().getSymbolicName(), XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, true, fPreferenceScopes));
    } catch (Exception e) {
    // TODO: Unable to set the preference. Log this problem.
    }
    XMLValidationReport valreport = validator.validate(uri, inputstream, configuration, result, context);
    return valreport;
}
Also used : XMLValidationConfiguration(org.eclipse.wst.xml.core.internal.validation.XMLValidationConfiguration) XMLValidationReport(org.eclipse.wst.xml.core.internal.validation.XMLValidationReport) IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Aggregations

IPreferencesService (org.eclipse.core.runtime.preferences.IPreferencesService)1 XMLValidationConfiguration (org.eclipse.wst.xml.core.internal.validation.XMLValidationConfiguration)1 XMLValidationReport (org.eclipse.wst.xml.core.internal.validation.XMLValidationReport)1