My validatorV2 extension disables XML source validation [message #785407] |
Sat, 28 January 2012 19:19  |
Eclipse User |
|
|
|
I'd like to add XML editor source (as-you-type) validation for my own xml based content type ("xml2"). However, contributing the org.eclipse.wst.validation.validatorV2 extension as shown below seems to disable source validation for the original org.eclipse.core.runtime.xml content type (and it doesn't work for my xml2 type either).
Normal batch validation still works for both xml and xml2. Source validation clearly stopped working because no red squiggly lines are drawn for invalid <tag></tag2> elements (for example) when editing xml or xml2 files using the WST XML editor. I'm using Eclipse JEE/Indigo SR1:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.xml"
file-extensions="xml2"
id="validator-test.xml2"
name="XML2"
priority="normal">
</content-type>
</extension>
<extension
id="id1"
name="name"
point="org.eclipse.wst.validation.validatorV2">
<validator
build="true"
class="org.eclipse.wst.xml.core.internal.validation.eclipse.Validator"
manual="true"
markerId="org.eclipse.wst.xml.core.validationMarker"
sourceid="org.eclipse.wst.xml.ui.internal.validation.DelegatingSourceValidatorForXML"
version="3">
<include>
<rules>
<contentType
exactMatch="true"
id="validator-test.xml2">
</contentType>
</rules>
</include>
</validator>
</extension>
If I remove the source validator entry (sourceid="org.eclipse.wst.xml.ui.internal.validation.DelegatingSourceValidatorForXML") from my plugin.xml then source validation starts working again for the normal xml content type (but obviously not for my own content type).
Has anybody been able to get source validation to work for their own XML based content type? DelegatingSourceValidatorForXML seems to stop working properly after it's been re-contributed. Source validation *mostly* works if I remove the validatorV2 extension and instead manually add my content type to: Preferences + Validation + XML validator + Settings, while there has been a couple of times when that stopped working as well (and I needed to remove and then add them back in).
John
|
|
|
|
|
|
Re: My validatorV2 extension disables XML source validation [message #827040 is a reply to message #826945] |
Thu, 22 March 2012 16:28   |
Eclipse User |
|
|
|
Hi,
at first, I didn't try to manually associate the validators as I didn't initially considered to override any existing implementation (I just want the exactly same behaviour as the XML, but for my own content-type which only differs from the XML content-type by the file extension).
(By the way, I'm not sure of what you mean when you ask "Do your validators work if you manually make the associations ?").
So, I just tried to "duplicate" as many contributions needed for the XML content-type, but for my own specific "XML-like" content-type to get the same functionalities (problem marker, sourcevalidation and ValidatorV2 as far as I remember).
For now, all functionnalities work for XML and only the "as-you-type" validation doesn't work for my content-type.
Now, I'm trying to figure out why it doesn't work by debugging the WST validator framework by comparing the call stacks/code calling tree between an editor on an XML file and another one on my own content-type.
I think I'm not far of a solution by declaring a sourcevalidation contribution and a ValidatorV2 pointing on a Validator class which default internal validator ID is pointing on the Validator markerId value. I'll detail a little bit more this particular point tomorrow from work.
Regards and sorry for the long post.
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07837 seconds