Community
Participate
Working Groups
the private method signutare in org.eclipse.wst.html.core.internal.validate.HTMLAttributeValidator : private boolean hasJSPRegion(ITextRegion container) should be replaced with: protected boolean hasForeignRegion(ITextRegion container) --------- ------- this will enable the PHP and other plugins to use this validator. bests, BTW - I wanted to workaround this validator by duplicate it, but there are many "package" classes in this mechanism. too bad for us I guess. but this is the reason I set it to major and it will be very important to have it on 2.0.2. Have I said thank you guys?
Roy, the method's not meant to be independently callable, so how would changing the access rule enable its usage by other plug-ins? I can understand the desire to at least rename it, though. Additionally, the isNestedTagName() method contains duplicates of some JSP-only text region contexts. There might be a better way to accomplish the same goal.
Nitin, We will inherit from this class and override the hasForeignRegion() method, then we will register our validator instead of the original one. We are used to it here in the PDT project :-) (In reply to comment #1) > Roy, the method's not meant to be independently callable, so how would changing > the access rule enable its usage by other plug-ins? I can understand the > desire to at least rename it, though. Additionally, the isNestedTagName() > method contains duplicates of some JSP-only text region contexts. There might > be a better way to accomplish the same goal.
Any progress on this issue? it is a major bug for the PHP users since they get the 'undefined attribute name' error message
I'm not sure I like the idea of making that class extendable. You'd still have to swap out the original HTMLAttributeValidator instance at runtime in favor of a subclass you create, right? Why not a private copy?
you don't have to do the CLASS extendable, there are more ways you can support PHP regions. You can set an extension point to add foreign languages, just like JSP region type. A private copy will make our lives miserable since we will need to update it whenever you guys fix the classes. this is not what you want, exactly like JSP guys don't like it. Regards,
I agree with Nitin that the validator class is not meant to be subclassed. In fact, all the classes in org.eclipse.wst.html.core.internal.validate should be package protected. I know private copying can be a pain, but it's actually better to do that when possible instead of subclassing internal classes. By having your own copy, you have more control, and you won't get stuck if we change behaviour in an internal class that is not beneficial to you. HTML validation, specifically, is likely to change a good deal in WTP 3.0 to fix bug 170646. I know that if you try to create your own copy of HTMLAttributeValidator, you'll run into package protected classes, but in most cases, those package protected classes are not essential to the main logic of HTMLAttributeValidator#validate(). Most of the package protected classes are just to figure out how to write the error message. If you're providing your own validator, you can/should also provide your own error messages.
please admit that it is very frustrating that you can put effort to be JSP sensetive and you don't see any point in adding PHP checks. What if I asked you to add these changes in this class? private boolean isNestedTagName(String regionType) { final String JSP_SCRIPTLET_OPEN = "JSP_SCRIPTLET_OPEN"; //$NON-NLS-1$ final String JSP_EXPRESSION_OPEN = "JSP_EXPRESSION_OPEN"; //$NON-NLS-1$ final String JSP_DECLARATION_OPEN = "JSP_DECLARATION_OPEN"; //$NON-NLS-1$ final String JSP_DIRECTIVE_OPEN = "JSP_DIRECTIVE_OPEN"; //$NON-NLS-1$ final String PHP_OPEN = "PHP_OPEN"; //$NON-NLS-1$ boolean result = regionType.equals(PHP_OPEN) || regionType.equals(JSP_SCRIPTLET_OPEN) || regionType.equals(JSP_EXPRESSION_OPEN) || regionType.equals(JSP_DECLARATION_OPEN) || regionType.equals(JSP_DIRECTIVE_OPEN); return result; } Would it be a problem? it is exactly the same check as JSP? Regards, - Roy
It's very similar, but the JSP-ness stems from a history where ALL of the core plug-ins were one big plug-in and ALL of the UI plug-ins were one large plug-in (note the misspelled comment about "expedency"). In future cases we want to avoid anything like that.
Created attachment 85010 [details] org.eclipse.wst.html.core.patch This patch renames hasJSPRegion() to hasNestedRegion() and removes the call to check isNestedTagName() altogether in hasNestedRegion(). All hasNestedRegion() will check is if the region passed in is an ITextRegionContainer with at least one region in it. If it is, then the region is considered a nested region and nested regions will be ignored by the html attribute validator.
Roy, please let me know if this patch solves your problem. If so, and you still want this fixed in WTP 2.0.2, I'll mark this as a hotbug requested by the PDT project.
yes it perfectly solves my problem, Great to hear it will be merged to 2.0.2! Thank you,
fix released for next week's wtp 2.0.2 ibuild and for this week's wtp 3.0m5 ibuild.