blob: b4a15da9f701f8e5452bdf2bcb9fe2f441b2269a [file]
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.wst.html.core" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.wst.html.core" id="syntaxValidator" name="Validator"/>
</appInfo>
<documentation>
Extension point which allows to add external validators for HTML5-like attributes.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="validator" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="validator">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.wst.html.core.internal.validate.extension.IHTMLCustomAttributeValidator:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
Extension point for validating custom html attributes. Only one error message will be displayed for each validated attribute.
&lt;pre&gt;
&lt;extension point=&quot;org.eclipse.wst.html.core.syntaxValidator&quot;&gt;
&lt;validator class=&quot;org.package.YourValidator&quot;&gt;&lt;/validator&gt;
&lt;/extension&gt;
&lt;/pre&gt;
YourValidator should implement IHTMLCustomAttributeValidator
&lt;pre&gt;
public class YourValidator impements IHTMLCustomAttributeValidator{
public boolean canValidate(IDOMElement target) {
if (target.getLocalName().startsWith(&quot;tag&quot;)) {
return true;
}
return false;
}
public void init() {
//called only once while validator was loaded
}
public ValidationMessage validateAttribute(IDOMElement target, String attrName) {
String tagName = target.getLocalName();
if (&quot;tag&quot;.equals(tagName)) {
if (attrName.startsWith(&quot;attr&quot;)) {
Segment segment = CustomValidatorUtil.getAttributeSegment((IDOMNode)target.getAttributeNode(attrName), ATTR_REGION_NAME);
return new ValidationMessage(&quot;Attribute started with attr is not allowed&quot;, segment.getOffset(), segment.getLength(), ValidationMessage.ERROR);
}
}
return null;
}
}
&lt;/pre&gt;
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiinfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>