Search in sources :

Example 1 with XSDValidationConfiguration

use of org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration in project webtools.sourceediting by eclipse.

the class Validator method validate.

/* (non-Javadoc)
   * @see org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator#validate(java.lang.String, java.io.InputStream, org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext)
   */
public ValidationReport validate(String uri, InputStream inputstream, NestedValidatorContext context) {
    XSDValidator validator = XSDValidator.getInstance();
    XSDValidationConfiguration configuration = (XSDValidationConfiguration) xsdConfigurations.get(context);
    ValidationReport valreport = null;
    valreport = validator.validate(uri, inputstream, configuration);
    return valreport;
}
Also used : ValidationReport(org.eclipse.wst.xml.core.internal.validation.core.ValidationReport) XSDValidationConfiguration(org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration)

Example 2 with XSDValidationConfiguration

use of org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration in project webtools.sourceediting by eclipse.

the class Validator method setupValidation.

/* (non-Javadoc)
   * @see org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator#setupValidation(org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext)
   */
protected void setupValidation(NestedValidatorContext context) {
    XSDValidationConfiguration configuration = new XSDValidationConfiguration();
    boolean honourAllSchemaLocations = XMLCorePlugin.getDefault().getPluginPreferences().getBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS);
    boolean fullSchemaConformance = XSDCorePlugin.getDefault().getPluginPreferences().getBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE);
    try {
        configuration.setFeature(XSDValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, honourAllSchemaLocations);
        configuration.setFeature(XSDValidationConfiguration.FULL_SCHEMA_CONFORMANCE, fullSchemaConformance);
    } catch (Exception e) {
    // Unable to set the honour all schema locations option. Do nothing.
    }
    xsdConfigurations.put(context, configuration);
    super.setupValidation(context);
}
Also used : XSDValidationConfiguration(org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration)

Example 3 with XSDValidationConfiguration

use of org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration in project webtools.sourceediting by eclipse.

the class BugFixesTest method testHonourAllSchemaLocations.

/**
 * Test /BugFixes/HonourAllSchemaLocations/dog.xsd
 */
public void testHonourAllSchemaLocations() {
    String testname = "dog";
    String testfile = FILE_PROTOCOL + PLUGIN_ABSOLUTE_PATH + SAMPLES_DIR + BUGFIXES_DIR + "HonourAllSchemaLocations/" + testname + ".xsd";
    String loglocation = PLUGIN_ABSOLUTE_PATH + GENERATED_RESULTS_DIR + BUGFIXES_DIR + "HonourAllSchemaLocations/" + testname + ".xsd-log";
    String idealloglocation = PLUGIN_ABSOLUTE_PATH + IDEAL_RESULTS_DIR + BUGFIXES_DIR + "HonourAllSchemaLocations/" + testname + ".xsd-log";
    XSDValidationConfiguration configuration = new XSDValidationConfiguration();
    try {
        configuration.setFeature(XSDValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, true);
    } catch (Exception e) {
        fail("Unable to set the HONOUR_ALL_SCHEMA_LOCATIONS feature to true: " + e);
    }
    runTest(testfile, loglocation, idealloglocation, configuration);
}
Also used : XSDValidationConfiguration(org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration)

Example 4 with XSDValidationConfiguration

use of org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration in project webtools.sourceediting by eclipse.

the class BugFixesTest method testFullConformance.

/**
 * Test /BugFixes/FullConformance/FullConformance.xsd
 * bug 147033
 */
public void testFullConformance() {
    String testname = "FullConformance";
    String testfile = FILE_PROTOCOL + PLUGIN_ABSOLUTE_PATH + SAMPLES_DIR + BUGFIXES_DIR + "FullConformance/" + testname + ".xsd";
    String loglocation = PLUGIN_ABSOLUTE_PATH + GENERATED_RESULTS_DIR + BUGFIXES_DIR + "FullConformance/" + testname + ".xsd-log";
    String idealloglocation = PLUGIN_ABSOLUTE_PATH + IDEAL_RESULTS_DIR + BUGFIXES_DIR + "FullConformance/" + testname + ".xsd-log";
    XSDValidationConfiguration configuration = new XSDValidationConfiguration();
    try {
        configuration.setFeature(XSDValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, true);
        configuration.setFeature(XSDValidationConfiguration.FULL_SCHEMA_CONFORMANCE, true);
    } catch (Exception e) {
        fail("Unable to set the FULL_SCHEMA_CONFORMANCE feature to true: " + e);
    }
    runTest(testfile, loglocation, idealloglocation, configuration);
}
Also used : XSDValidationConfiguration(org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration)

Aggregations

XSDValidationConfiguration (org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration)4 ValidationReport (org.eclipse.wst.xml.core.internal.validation.core.ValidationReport)1