Steps for providing semantic validation

Implement the SPI for xml validation: org.netbeans.modules.xml.xam.spi.Validator


org.netbeans.modules.xml.xam.spi.Validator { {
     * Returns name of this validation service.
     * @return Name of the validator.
    String getName();
     * Validates given model.
     * @return ValidationResult.
     * @param validationType Type of validation. Complete(slow) or partial(fast). 
     * @param model model to validate.
     * @param validation reference to the validation context.
    ValidationResult validate(Model model, Validation validation, ValidationType validationType);
    enum ResultType {
  1. Add module dependency to wsdleditor
  2. Implement the above methods in a class
  3. Create a folder called META-INF/Services
  4. Create a file by name org.netbeans.modules.xml.xam.spi.Validator
  5. Add the line for your class that implements Validator in this above file
  6. Make sure that you validate only those elements that you control.

For example look at C:\nb_all\wsdlextensions.file\src\META-INF\services\org.netbeans.modules.xml.xam.spi.Validator and org.netbeans.modules.wsdlextensions.file.validator.FileComponentValidator

Make sure that the implementation of the Validator is thread safe. The validators are cached.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo