[Htmlparser-cvs] htmlparser/src/org/htmlparser/lexer/nodes TagNode.java,1.19,1.20
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-10-27 02:18:24
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes In directory sc8-pr-cvs1:/tmp/cvs-serv25308/lexer/nodes Modified Files: TagNode.java Log Message: Some speed improvements; passing tags to evaluate, creating strings without string buffers, etc. Index: TagNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes/TagNode.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** TagNode.java 26 Oct 2003 19:46:18 -0000 1.19 --- TagNode.java 27 Oct 2003 02:18:04 -0000 1.20 *************** *** 157,160 **** --- 157,161 ---- StringBuffer buffer; char quote; + Attribute attribute; // first determine if there's whitespace in the value *************** *** 203,207 **** else quote = 0; ! setAttribute (key, value, quote); } --- 204,216 ---- else quote = 0; ! attribute = getAttributeEx (key); ! if (null != attribute) ! { // see if we can splice it in rather than replace it ! attribute.setValue (value); ! if (0 != quote) ! attribute.setQuote (quote); ! } ! else ! setAttribute (key, value, quote); } *************** *** 594,605 **** public String toHtml () { ! StringBuffer ret; Vector attributes; Attribute attribute; ! ret = new StringBuffer (); attributes = getAttributesEx (); ret.append ("<"); ! for (int i = 0; i < attributes.size (); i++) { attribute = (Attribute)attributes.elementAt (i); --- 603,623 ---- public String toHtml () { ! int length; ! int size; Vector attributes; Attribute attribute; + StringBuffer ret; ! length = 2; attributes = getAttributesEx (); + size = attributes.size (); + for (int i = 0; i < size; i++) + { + attribute = (Attribute)attributes.elementAt (i); + length += attribute.getLength (); + } + ret = new StringBuffer (length); ret.append ("<"); ! for (int i = 0; i < size; i++) { attribute = (Attribute)attributes.elementAt (i); |