Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Validator V2

Identifier:
org.eclipse.wst.validation.validator-v2

Since:
WebTools 3.0.

Description:
This is used to register a validator to the validation framework (version 2). In addition to specifying the validator to invoke, it registers a set of default filter rules, to control which resources are passsed to the validator.

Configuration Markup:

<!ELEMENT extension ( validator)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #REQUIRED

name  CDATA #REQUIRED>

  • id - A short id that is unique within the plug-in, so that this validator can be identified.
  • name - The short user friendly name of the validator.

<!ELEMENT validator ( include* , exclude? , messageCategory* , group*)>

<!ATTLIST validator

class    CDATA #REQUIRED

build    (true | false)

manual   (true | false)

version  CDATA #IMPLIED

sourceid CDATA #IMPLIED

markerId CDATA #IMPLIED>

Defines a validator to the validation framework.


  • class - The class that implements the validator.
  • build - Is this validator enabled by default for build based validations? The default is true.
  • manual - Is this validator enabled by default for manual based validations? The default is true.
  • version - The version of the definition. It is a simple integer. If not specified the version is assumed to be 1.
  • sourceid - If this validator also serves as an as-you-type validator (also know as an ISourceValidator) then it's source id is specified here, so that the two validators can be associated with one another. By source id, we mean the id that is used in the org.eclipse.wst.sse.ui.sourceValidation extension point
  • markerId - If your validator wishes to use it's own marker, it can do so by supplying that marker id here.

<!ELEMENT include ( rules)>

This contains a set of inclusion rules, which are used in filtering which resources get validated. At least one of these rules must be satisfied in order for the validator to be called on the particular resource.



<!ELEMENT exclude ( rules)>

This contains a set of exclusion rules, used in filtering which resources get validated. If any of these rules are matched, then the validator is not called on this resource.



<!ELEMENT fileext EMPTY>

<!ATTLIST fileext

ext           CDATA #REQUIRED

caseSensitive (true | false) >

A file extension, for example html.


  • ext - The file extension, for example html.
  • caseSensitive - If the file extension is case sensitive, then this needs to be set to true.

<!ELEMENT projectNature EMPTY>

<!ATTLIST projectNature

id CDATA #REQUIRED>

Used to filter on project natures.


  • id - The fully qualified project nature id, for example "org.eclipse.jdt.core.javanature".

<!ELEMENT file EMPTY>

<!ATTLIST file

name          CDATA #REQUIRED

caseSensitive (true | false)

type          (folder|file|full) >

  • name - The file or folder name. The file name can be fully qualified, that is it starts with a leading slash ("/"), or it can be a relative name. Folder names are separated with the forward slash ("/") character.
  • caseSensitive - If the file name is not case senstitive, then this needs to be set to false.
  • type - Type of name, there are three choices.
    • folder - specifies a project relative folder name.
    • file - a simple file name (i.e. no path information).
    • full - a fully qualified (project relative) file name.

<!ELEMENT rules ( fileext* , file* , projectNature* , facet* , contentType* , pattern*)>

A set of rules for determining if a resource is passed to this validator or not. The rules are OR'ed together.



<!ELEMENT facet EMPTY>

<!ATTLIST facet

id      CDATA #REQUIRED

version CDATA #IMPLIED>

  • id - The facet id.
  • version - A version expression that can be used to futher qualify the match. If not specifed, then versions are not used as a criteria for selecting the facet. The syntax of this expression, is the same syntax that is used by the facet framework.

<!ELEMENT group EMPTY>

<!ATTLIST group

id IDREF #REQUIRED>

Declares that this validator belongs to this validation group.


  • id - The fully qualified ID of the validation group to which this validator belongs.

<!ELEMENT contentType EMPTY>

<!ATTLIST contentType

id         CDATA #REQUIRED

exactMatch (true | false) >

Used to filter based on content types.


  • id - The content type id.
  • exactMatch - Set to true if the content type needs to match exactly. Set to false if sub types are considered matches as well.

<!ELEMENT messageCategory EMPTY>

<!ATTLIST messageCategory

id       CDATA #REQUIRED

label    CDATA #REQUIRED

severity (error|warning|ignore) >

Used to group together a set of messages, where the user can change the message severity of all the messages in the group. This is similar to the support in the JDT, where for example a user can specify whether used methods should be errors, warnings or ignored.


  • id - A simple id that is unique within the scope of this validator.
  • label - A short, one line label that is displayed to the end user, that describes the message category.
  • severity - The default severity for this category.

<!ELEMENT pattern EMPTY>

<!ATTLIST pattern

regex         CDATA #REQUIRED

caseSensitive (true | false) >

Holds a regualr expression, that matches the resource's project relative name.


  • regex - Holds a Java regular expression. See the class java.util.regex.Pattern for more details. This regular expression is matched against a resource's project relative path, after that path has been converted into a portable path.

    The path will always start with a forward slash (/) so that folder names can be more easily matched.

  • caseSensitive - If the file name is not case senstitive, then this needs to be set to false.

Examples:
An example of a validator that will be called on resources that have html or htm file extensions.

   <extension
         point=
"org.eclipse.wst.validation.validator"

         id=
"Test"
 name=
"%Validator.Name"
>
      <validator class=
"org.eclipse.wst.validation.test.TestValidator"
>
         <include>
            <rules>
               <fileext ext=
"html"
/>
               <fileext ext=
"htm"
/>
            </rules>
         </include>
      </validator>
   </extension>


Copyright (c) 2007,2008 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v10.html


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire