[Htmlparser-cvs] htmlparser/src/org/htmlparser/parserHelper AttributeParser.java,1.33,1.34
Brought to you by:
derrickoswald
|
From: <der...@us...> - 2003-08-15 21:01:47
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserHelper
In directory sc8-pr-cvs1:/tmp/cvs-serv3543/parserHelper
Modified Files:
AttributeParser.java
Log Message:
Case maintaining toHtml() output for tag attributes.
With these changes, the output of toHtml() now reflects the upper/lower case values
of the input for the contents of tags, i.e. attribute names maintain their original case.
They're still out of order from how they are parsed, but this is a first step.
Rather than adjust all the test cases right now, the ParserTestCase assertSameString()
method now checks a global flag to see if case matters when comparing strings.
As of this drop it ignores case when comparing HTML output. This will soon change.
Index: AttributeParser.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserHelper/AttributeParser.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** AttributeParser.java 11 Aug 2003 00:18:29 -0000 1.33
--- AttributeParser.java 15 Aug 2003 20:51:47 -0000 1.34
***************
*** 104,108 ****
*
*/
! public Hashtable parseAttributes(Tag tag) {
attributeTable = new SpecialHashtable();
part = null;
--- 104,108 ----
*
*/
! public Hashtable parseAttributes (String text) {
attributeTable = new SpecialHashtable();
part = null;
***************
*** 113,117 ****
equal = false;
delim=DELIMETERS;
! tokenizer = new StringTokenizer(tag.getText(),delim,true);
while (true) {
part=getNextPartUsing(delim);
--- 113,117 ----
equal = false;
delim=DELIMETERS;
! tokenizer = new StringTokenizer(text,delim,true);
while (true) {
part=getNextPartUsing(delim);
***************
*** 132,136 ****
}
}
! if (null == element) // handle no tag contents
putDataIntoTable(attributeTable,"",null,true);
return attributeTable;
--- 132,136 ----
}
}
! if (null == element) // handle no contents
putDataIntoTable(attributeTable,"",null,true);
return attributeTable;
***************
*** 259,267 ****
if (isName) {
// store tagname as tag.TAGNAME,tag
! h.put(value,name.toUpperCase());
}
else {
// store tag parameters as NAME, value
! h.put(name.toUpperCase(),value);
}
}
--- 259,267 ----
if (isName) {
// store tagname as tag.TAGNAME,tag
! h.put(value,new String[] {value, name.toUpperCase()});
}
else {
// store tag parameters as NAME, value
! h.put(name.toUpperCase(),new String[] {name, value });
}
}
|