Custom XML Validation on top of schema validation [message #173375] |
Thu, 06 July 2006 11:50  |
Eclipse User |
|
|
|
Im trying to implement custom validation, on top of the schema validation.
What WTP gives me out of the box is great (schema validation), but i want to
add on top of that specific things that the schema cannot catch (such as
presence/absence of certain tags when the parent has attributes set, ...)
I have the extension point org.eclipse.wst.validation.validator with
org.eclipse.wst.xml.core.internal.validation.core.Helper and my own run
class that basically ends up to the XMLValidator now, and it runs when the
file is saved.
Now I want to nix the XMLValidator and do my own thing here. My question is
this, what should I do from here, do I get a DOM and check the things from
that, Is there a way to extend the SAX parse to catch it, or something else
I dont know about... I have never used SAX before and am somewhat new to
the validation thing.
Hope all that makes sense.
I thank you for your suggestions.
Cheers
Brian J
|
|
|
|
Re: Custom XML Validation on top of schema validation [message #174459 is a reply to message #174152] |
Fri, 14 July 2006 10:57  |
Eclipse User |
|
|
|
Thanks Lawrence,
Here is what I ended up doing, my runtime side has rules validation that i
need, and I wanted to try to reuse that, I ahve my validator action ...
setup very similar to the XML validator, and instead of using the XML one, I
use mine and return the XMLValidationreport with my errors in it.
Works as I would like it to, although I am implementing and using some
internal/provisional classes, but it is experimanetal for now.
<lmandel@ca.ibm.com> wrote in message news:e93cjk$hqa$2@utils.eclipse.org...
> Hi Brian,
>
>>Now I want to nix the XMLValidator and do my own thing here. My question
> is
>>this, what should I do from here, do I get a DOM and check the things
> from
>>that, Is there a way to extend the SAX parse to catch it, or something
> else
>>I dont know about... I have never used SAX before and am somewhat new to
>
>>the validation thing.
>
> You can use either method. Here is a simplified overview. DOM is useful if
> you need to build the entire model before validating, as is the case with
> WSDL. For example, if you want to check that references amoung elements
> are correct. SAX is lighter weight than DOM and is useful if you want to
> check the current element. For example, if you want to implement naming
> convention checks where all you're checking is the name of the current
> element.
>
> You can find more information about DOM and SAX from the Xerces site [1]
> and from the W3C [2].
>
> [1] http://xerces.apache.org
> [2] http://www.w3.org/DOM/
>
> Lawrence
|
|
|
Powered by
FUDForum. Page generated in 0.02754 seconds