Saturday, July 4, 2009

Cause of Eclipse WTP Bug #245698

After I reproduced the bug successfully, I started to look into the reason why the newly created XML file did not pass the validation. Here is a screen shot of the XML file generated from web-jsptaglibrary_2_1.xsd:

In the screen shot, notice that there are 26 errors in the XML file, and the major one is "cvc-complex-type.3.2.2: Attribute 'javaee:lang' is not allowed to appear in element 'javaee:description'", which applied to all <javaee:description>, <javaee:display-name>, and <javaee:icon tags in the XML file>.

What this error mean is javaee:lang is not a valid attribute inside <javaee:description>, <javaee:display-name>, and <javeee:icon>. So, I checked out the XML schema definition file web-jsptaglibrary_2_1.xsd.

Lines in between <xsd:complexType name="tldTagLibType"\> and its corresponding </xsd:complexType> is the type definition for tldTagLibType - type of taglib. Those lines are saying taglib can the following child tags in sequence: description(optional), display-name, icon(optional), tlib-version, short-name, uri, validator, listener(optional), tag(optional), tag-file, function, and tablib-extension. And also, description, display-name, and icon are grouped together and defined as "descriptionGroup".

So, to check out the definition for <javaee:description>, <javaee:display-name>, and <javaee:icon>, I first found XML schema definition file in which "descriptionGroup" is defined, and it is javaee_5.xsd. Surprisingly, the definition of descriptionGroup, description, display-name, and icon are all in javaee_5.xsd.



After checking out the definition for descriptionType, I found out that the correct prefix for lang attribute inside <javaee:description> should be xml, rather that javaee, which is also true to <javaee:display-name> and <javaee:icon>.

Then, I tried to changed all javaee:lang inside <javaee:description>, <javaee:display-name>, and <javaee:icon> of the XML file generated from web-jsptaglibrary_2_1.xsd to xml:lang. Compared to the previous screen shot on the newly created XML file. All "cvc-complex-type.3.2.2: Attribute 'javaee:lang' is not allowed to appear in element 'javaee:description'" are gone.

So, the cause of this bug is the prefix for the lang attribute inside <javaee:description>, <javaee:display-name>, and <javaee:icon> is not configured correctly.

1 comment:

  1. Hi, Terry.
    It's great to read your blog posting via the CDOT Planet. Keep up you good work!