You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Folke Behrens (JIRA)" <de...@tapestry.apache.org> on 2008/01/14 12:15:34 UTC

[jira] Commented: (TAPESTRY-1487) Consider checking for org.xml.sax.ext.Attributes2

    [ https://issues.apache.org/jira/browse/TAPESTRY-1487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558571#action_12558571 ] 

Folke Behrens commented on TAPESTRY-1487:
-----------------------------------------

Instead of just using org.xml.sax.Attributes you could check for org.xml.sax.ext.Attributes2 and then use the method isSpecied(int) to check if an attribute is really specified inside the template. This concerns TemplateParserImpl which uses XMLReader.

e.g.:
The anchor tag (<a>) has an attribute "shape" with a default value of "rect". If the SAX parser validates the template source against an HTML DTD the parser will always append the attribute "shape" to the attribute list of any <a> tag even though this attribute may not have been specified. To check for the latter SAX has been extended by the Attributes2 interface.

It's probably a good idea to have a look at Attributes2 and isSpecified():
http://java.sun.com/javase/6/docs/api/org/xml/sax/ext/Attributes2.html#isSpecified(int)


> Consider checking for org.xml.sax.ext.Attributes2
> -------------------------------------------------
>
>                 Key: TAPESTRY-1487
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1487
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.0.4
>         Environment: Sun JDK 1.5
>            Reporter: Folke Behrens
>            Assignee: Howard M. Lewis Ship
>            Priority: Trivial
>
> Consider testing for org.xml.sax.ext.Attributes2 and use Attributes2.isSpecified(int) to check if the attribute is really specified or just a default declaration.
> With this you can e.g. test if <a  shape="rect" > is really set. Test for "http://xml.org/sax/features/use-attributes2" or just use "instanceof":
> if (attributes instanceof Attributes2) {
>     if (( (Attributes2)attributes ).isSpecified(i)) {
>         // do something
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org