[Htmlparser-cvs] htmlparser/src/org/htmlparser/lexer/nodes TagNode.java,1.28,1.29
Brought to you by:
derrickoswald
From: <der...@pr...> - 2004-01-27 13:34:45
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26191/lexer/nodes Modified Files: TagNode.java Log Message: Fix bug #883664 toUpperCase on tag names and attributes depends on locale Added locale information to all relevant toUpperCase() calls, with an English locale for tag names and attribute names, or developers choice of locale for methods that do uppercase conversion as part of their algorithms. Index: TagNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes/TagNode.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** TagNode.java 14 Jan 2004 02:53:46 -0000 1.28 --- TagNode.java 25 Jan 2004 21:32:59 -0000 1.29 *************** *** 29,35 **** import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; - import org.htmlparser.AbstractNode; import org.htmlparser.lexer.Cursor; import org.htmlparser.lexer.Lexer; --- 29,36 ---- import java.util.Enumeration; import java.util.Hashtable; + import java.util.Locale; import java.util.Vector; + import org.htmlparser.AbstractNode; import org.htmlparser.lexer.Cursor; import org.htmlparser.lexer.Lexer; *************** *** 340,348 **** * <code>String</code> objects available from this <code>Hashtable</code>. * @return Returns a list of name/value pairs representing the attributes. ! * These are not in order, the keys (names) are capitalized and the values * are not quoted, even if they need to be. The table <em>will</em> return * <code>null</code> if there was no value for an attribute (no equals * sign or nothing to the right of the equals sign). A special entry with * a key of SpecialHashtable.TAGNAME ("$<TAGNAME>$") holds the tag name. */ public Hashtable getAttributes () --- 341,350 ---- * <code>String</code> objects available from this <code>Hashtable</code>. * @return Returns a list of name/value pairs representing the attributes. ! * These are not in order, the keys (names) are converted to uppercase and the values * are not quoted, even if they need to be. The table <em>will</em> return * <code>null</code> if there was no value for an attribute (no equals * sign or nothing to the right of the equals sign). A special entry with * a key of SpecialHashtable.TAGNAME ("$<TAGNAME>$") holds the tag name. + * The conversion to uppercase is performed with an ENGLISH locale. */ public Hashtable getAttributes () *************** *** 360,364 **** // special handling for the node name attribute = (Attribute)attributes.elementAt (0); ! ret.put (SpecialHashtable.TAGNAME, attribute.getName ().toUpperCase ()); // the rest for (int i = 1; i < attributes.size (); i++) --- 362,366 ---- // special handling for the node name attribute = (Attribute)attributes.elementAt (0); ! ret.put (SpecialHashtable.TAGNAME, attribute.getName ().toUpperCase (Locale.ENGLISH)); // the rest for (int i = 1; i < attributes.size (); i++) *************** *** 372,376 **** if (null == value) value = SpecialHashtable.NULLVALUE; ! ret.put (attribute.getName ().toUpperCase (), value); } } --- 374,378 ---- if (null == value) value = SpecialHashtable.NULLVALUE; ! ret.put (attribute.getName ().toUpperCase (Locale.ENGLISH), value); } } *************** *** 391,394 **** --- 393,397 ---- * To get at the original text of the tag name use * {@link #getRawTagName getRawTagName()}. + * The conversion to uppercase is performed with an ENGLISH locale. * </em> * @return The tag name. *************** *** 401,405 **** if (null != ret) { ! ret = ret.toUpperCase (); if (ret.startsWith ("/")) ret = ret.substring (1); --- 404,408 ---- if (null != ret) { ! ret = ret.toUpperCase (Locale.ENGLISH); if (ret.startsWith ("/")) ret = ret.substring (1); *************** *** 673,677 **** public boolean breaksFlow () { ! return (breakTags.containsKey (getTagName ().toUpperCase ())); } --- 676,680 ---- public boolean breaksFlow () { ! return (breakTags.containsKey (getTagName ())); } |