Home » Language IDEs » ServerTools (WTP) » Validation framework
Validation framework [message #64315] |
Tue, 11 January 2005 00:10  |
Eclipse User |
|
|
|
I've been studying the validation framework - thank goodness for the runtime
workbench and the Eclipse debugger :)
I need to do schema based validation, but also some custom checking of
attribute values, which I think will be best done in an additional
validation pass (unless there's a way my plugin could dynamically update the
schema model).
I've hooked up a skeletal validator that gets run by the Run Validation
context menu (though only in J2EE perspective, it seems). I guess my
validator can run in addition to the standard XML validator. So far so good.
The reconciling validator doesn't seem as easy to extend, in the sense that
there's one of them, configured by a source editor configuration class. The
sse.ui plugin defines a reconcileValidator extension point, but no one seems
to use it. It seems if I want to defining a reconcile validator that reuses
(and adds to) the standard XML validator, I'd also have to use a lot of
Eclipse classes in internal packages.
Comments appreciated.
Thanks!
|
|
|
Re: Validation framework [message #64591 is a reply to message #64315] |
Tue, 11 January 2005 11:15   |
Eclipse User |
|
|
|
Originally posted by: pavery.us.ibm.com
Hi Richard,
I'm glad to hear you were investigating use of the reconciling
validator. I admit that the documentation is not yet up to par (which is
probably why you had to "investigate" with the debugger =). It looks
like the schema for the extension point is missing... I'll get that in
the repository. Overall documentation will be improved in the upcoming
milestones
As for the reconcile validator, you should be able to take an IValidator
(following the validation framework apis), and hook it up as a reconcile
validator via the "reconcileValidator" extension point.
In the extension point you can define what content types the validator
should run on, as well as which partition types within a file of that
content type it should run on. (look for the schema for
reconcileValidator in the org.eclipse.wst.sse.ui plugin shortly)
I'm not sure what you mean by "there's only one of them". There can as
many of these reconcile validators as plugins define via the extension
point.
We should be adding an HTML validator soon also, as an example of how
this extension point works. Possible future as-you-type validation
(css, dtd...) should be using this framework as well.
thanks,
-phil
Richard Rodseth wrote:
> I've been studying the validation framework - thank goodness for the runtime
> workbench and the Eclipse debugger :)
>
> I need to do schema based validation, but also some custom checking of
> attribute values, which I think will be best done in an additional
> validation pass (unless there's a way my plugin could dynamically update the
> schema model).
>
> I've hooked up a skeletal validator that gets run by the Run Validation
> context menu (though only in J2EE perspective, it seems). I guess my
> validator can run in addition to the standard XML validator. So far so good.
>
> The reconciling validator doesn't seem as easy to extend, in the sense that
> there's one of them, configured by a source editor configuration class. The
> sse.ui plugin defines a reconcileValidator extension point, but no one seems
> to use it. It seems if I want to defining a reconcile validator that reuses
> (and adds to) the standard XML validator, I'd also have to use a lot of
> Eclipse classes in internal packages.
>
> Comments appreciated.
> Thanks!
>
>
|
|
| |
Re: Validation framework [message #65005 is a reply to message #64733] |
Tue, 11 January 2005 22:41   |
Eclipse User |
|
|
|
Thanks. I don't have specific suggestions yet, but based on Phil's reply to
my post, it seems I could have an additional reconcileValidator and let the
standard XML reconcile validator do its thing as well, so the need for my
validator to invoke the XML validator is eliminated.
- Richard
"Craig Salter" <csalter@ca.ibm.com> wrote in message
news:cs1dt9$s4$1@www.eclipse.org...
> Richard Rodseth wrote:
>
>> I've been studying the validation framework - thank goodness for the
>> runtime workbench and the Eclipse debugger :)
>
>> I need to do schema based validation, but also some custom checking of
>> attribute values, which I think will be best done in an additional
>> validation pass (unless there's a way my plugin could dynamically update
>> the schema model).
>
>> I've hooked up a skeletal validator that gets run by the Run Validation
>> context menu (though only in J2EE perspective, it seems). I guess my
>> validator can run in addition to the standard XML validator. So far so
>> good.
>
>> The reconciling validator doesn't seem as easy to extend, in the sense
>> that there's one of them, configured by a source editor configuration
>> class. The sse.ui plugin defines a reconcileValidator extension point,
>> but no one seems to use it. It seems if I want to defining a reconcile
>> validator that reuses (and adds to) the standard XML validator, I'd also
>> have to use a lot of Eclipse classes in internal packages.
>
>> Comments appreciated.
>> Thanks!
>
> Hi Richard,
>
> Although most of our packges are 'internal' we will be eventually be
> 'extenalizing' some of these packages and providing official API's. If
> there's some methods you'd like to get at in the XML Validator ... or some
> extension points like like us to consider please post them here. Once we
> know what the community wants to reuse we'll have a better idea of what
> our API's need to look like.
>
>
>
>
|
|
|
Re: Validation framework [message #72987 is a reply to message #64315] |
Fri, 11 February 2005 00:13   |
Eclipse User |
|
|
|
As a follow-up, I'm just wondering about the state of the validation
framework and its documentation. Any point in downloading post-M2 builds?
I'm looking for the correct level to hook into the framework if I want to
use node-level interfaces to perform some validation of attribute values. I
noticed ReconcileStepAdapterForXML which looked promising, but couldn't
trace it's use.
Thanks!
- Richard
"Richard Rodseth" <rrodseth@mac.com> wrote in message
news:crvmkp$h9c$1@www.eclipse.org...
> I've been studying the validation framework - thank goodness for the
> runtime workbench and the Eclipse debugger :)
>
> I need to do schema based validation, but also some custom checking of
> attribute values, which I think will be best done in an additional
> validation pass (unless there's a way my plugin could dynamically update
> the schema model).
>
> I've hooked up a skeletal validator that gets run by the Run Validation
> context menu (though only in J2EE perspective, it seems). I guess my
> validator can run in addition to the standard XML validator. So far so
> good.
>
> The reconciling validator doesn't seem as easy to extend, in the sense
> that there's one of them, configured by a source editor configuration
> class. The sse.ui plugin defines a reconcileValidator extension point, but
> no one seems to use it. It seems if I want to defining a reconcile
> validator that reuses (and adds to) the standard XML validator, I'd also
> have to use a lot of Eclipse classes in internal packages.
>
> Comments appreciated.
> Thanks!
>
|
|
| |
Re: Validation framework [message #73172 is a reply to message #73024] |
Fri, 11 February 2005 10:44   |
Eclipse User |
|
|
|
Craig
By "as you type", do you mean on each keystroke, or after a brief pause? The
latter is how I thought reconcilers worked. If so, I don't see a fundamental
difference between red squiggles and entries in the problem view, and I
would expect schema-based validation errors to show up in the problems view
as well as in the tool tip over the red squiggle, which seems to be the
current behavior.
I simply want to add programmatic validation of certain attribute values.
Semantic validation which cannot be performed by the automatic schema-based
validation. The built-in validation against the schema should continue as
well.
I haven't looked at the DelegatingReconcileValidatorForXML yet, but I would
think that a reconciler would have a DOM available from the structured
editor's parser, so why run Xerces? Unless it's to be able to share code
with a validator that can run without the editor open, as in a project
builder, or when you right-click on a resource and choose "validate XML
File". I guess that makes sense, since you wouldn't want to build a DOM in
the latter case.
I'm still intrigued by the node adapter thing I referred to. If there were a
way for me to register a factory so that my own node subclass got
instantiated for a particular tag, and it could know about a validator for
that node type, that would be convenient. Or perhaps a node-level validator
could be registered with the validation framework.
- Richard
"Craig Salter" <csalter@ca.ibm.com> wrote in message
news:cuhgs0$tdj$1@www.eclipse.org...
> Richard Rodseth wrote:
>
>>> It seems if I want to defining a reconcile validator that reuses (and
>>> adds to) the standard XML validator, I'd also have to use a lot of
>>> Eclipse classes in internal packages.
>
> Richard,
>
> A couple of things I should clarify:
> - a reconcile validator is used to provide 'as you type' validation to
> give you 'red squiggles' in the source view.
> - a validation framework validator is used to provide error messages in
> the problems view.
>
> Having said that... it is (now) relatively easy to provide a 'validation
> framework validator' that can be reused as a reconcile validator.
>
> We've checked in some new code lately that might be enlightening. Take a
> look at the DelegatingReconcileValidatorForXML class in the xml.ui plugin.
> This class demonstrates how to tie our standard (xerces based) xml
> validator into the source editor to perform the 'red squiggles'.
> The DelegatingReconcileValidatorForXSD in the xsd.ui plugin provides
> another example of this same code pattern.
>
> I'm not 100% sure of what you're trying to do.. but I'm guessig you want
> to provide an XYZ validator that extends the XML validator (to do some
> additional checking) and then you could provide your own
> DelegatingReconcileValidatorForXYZ class to get the 'red squiggles'
> showing in the source editor.
> hope that helps
>
> craig
>
>
>
|
|
|
Re: Validation framework [message #73259 is a reply to message #73172] |
Fri, 11 February 2005 14:33   |
Eclipse User |
|
|
|
Richard Rodseth wrote:
> Craig
>
> By "as you type", do you mean on each keystroke, or after a brief pause? The
> latter is how I thought reconcilers worked. If so, I don't see a fundamental
> difference between red squiggles and entries in the problem view, and I
> would expect schema-based validation errors to show up in the problems view
> as well as in the tool tip over the red squiggle, which seems to be the
> current behavior.
>
The reconcileValidator gets called after a brief pause in editing.
Entries in the problem view only appear when the user selects validate,
or saves the file. A new entry does not get created in the problems for
a red squiggle, until the file is saved. This is also the way the java
editor behaves.
> I simply want to add programmatic validation of certain attribute values.
> Semantic validation which cannot be performed by the automatic schema-based
> validation. The built-in validation against the schema should continue as
> well.
>
> I haven't looked at the DelegatingReconcileValidatorForXML yet, but I would
> think that a reconciler would have a DOM available from the structured
> editor's parser, so why run Xerces? Unless it's to be able to share code
> with a validator that can run without the editor open, as in a project
> builder, or when you right-click on a resource and choose "validate XML
> File". I guess that makes sense, since you wouldn't want to build a DOM in
> the latter case.
Basically the way DelegatingReconcileValidatorForXML works is it gets
the list of IMessages from a delegate validator (which would be what is
calling Xerces somewhere) and improves the start offset and length to
give a good 'squiggle range'. For example, for a certain error key you
might want to underline a certain attribute. Xerces would give
coordinates somewhere near the element containing the attribute, but
that is not a good enough range to squiggle. The
DelegatingReconcileValidatorForXML uses information from the DOM to get
a more specific start and end offset of that attribute, and sets that
information in the IMessage.
>
> I'm still intrigued by the node adapter thing I referred to. If there were a
> way for me to register a factory so that my own node subclass got
> instantiated for a particular tag, and it could know about a validator for
> that node type, that would be convenient. Or perhaps a node-level validator
> could be registered with the validation framework.
>
> - Richard
>
>
> "Craig Salter" <csalter@ca.ibm.com> wrote in message
> news:cuhgs0$tdj$1@www.eclipse.org...
>
>>Richard Rodseth wrote:
>>
>>
>>>>It seems if I want to defining a reconcile validator that reuses (and
>>>>adds to) the standard XML validator, I'd also have to use a lot of
>>>>Eclipse classes in internal packages.
>>
>>Richard,
>>
>>A couple of things I should clarify:
>>- a reconcile validator is used to provide 'as you type' validation to
>>give you 'red squiggles' in the source view.
>>- a validation framework validator is used to provide error messages in
>>the problems view.
>>
>>Having said that... it is (now) relatively easy to provide a 'validation
>>framework validator' that can be reused as a reconcile validator.
>>
>>We've checked in some new code lately that might be enlightening. Take a
>>look at the DelegatingReconcileValidatorForXML class in the xml.ui plugin.
>>This class demonstrates how to tie our standard (xerces based) xml
>>validator into the source editor to perform the 'red squiggles'.
>>The DelegatingReconcileValidatorForXSD in the xsd.ui plugin provides
>>another example of this same code pattern.
>>
>>I'm not 100% sure of what you're trying to do.. but I'm guessig you want
>>to provide an XYZ validator that extends the XML validator (to do some
>>additional checking) and then you could provide your own
>>DelegatingReconcileValidatorForXYZ class to get the 'red squiggles'
>>showing in the source editor.
>>hope that helps
>>
>>craig
>>
>>
>>
>
>
>
|
|
| |
Re: Validation framework [message #73386 is a reply to message #73367] |
Fri, 11 February 2005 19:48  |
Eclipse User |
|
|
|
Craig,
An example of what I want to do would be to check that if an attribute
value is a path, that it represents a valid resource in the project
containing the XML file. Or more trivially, check that attribute values
are lower case. But I still want the schema-based validation to run. Maybe
there are examples of such things in the validators for J2EE artifacts.
I had been thinking that this could be a separate validator over and above
the XML Validator (that invokes XMLValidator). This would be fine in the
builder scenario, but when choosing Validate XML File in the context menu,
my equivalent of ValidateAction would presumably have to invoke
XMLValidator AND another MyXMLAttributeValidator. MyXMLAttributeValidator
would also have to copy or emulate a fair amount of internal stuff.
ValidationMessage etc. It's surprising how much stuff there is between the
menu and the sax parser parse() call, and between the SAX error handler
and the setting of markers.
Alternatively, I could have a validator that did what XMLValidator does,
plus my additions. It doesn't look particulary easy to extend XMLValidator
to configure the SAX Parser differently, but I don't have SAX experience,
so maybe I just haven't found it yet. Also, I suppose I would have to
figure out a way to disable XMLValidator for files of my type.
Thanks for any guidance,
- Richard
Craig Salter wrote:
> Richard Rodseth wrote:
>> I'm still intrigued by the node adapter thing I referred to. If there were
a
>> way for me to register a factory so that my own node subclass got
>> instantiated for a particular tag, and it could know about a validator for
>> that node type, that would be convenient. Or perhaps a node-level
validator
>> could be registered with the validation framework.
> Richard, can you post an example of the file your trying to validate and
> example of the additional validation you're trying to do? I'll be happy
> to take a look to see how 'doable' this is with what we currently provide.
|
|
|
Goto Forum:
Current Time: Thu Mar 13 15:27:47 EDT 2025
Powered by FUDForum. Page generated in 0.04646 seconds
|