[Htmlparser-developer] RE: [Htmlparser-user] version 1.5
Brought to you by:
derrickoswald
From: Alberto N. <alb...@ti...> - 2004-04-21 17:08:14
|
All the following suggestions are already done by me. I'd like to read your comments and maybe also improvement's ideas. Waiting for your advises, I continue test activity. I hope that all these improvements could make quick the process of changing the strings after the parser have processed the url stream. ---------------------------------------------------------------------------- --------- package org.htmlparser.util; Class NodeList I suggest to add two methods more: 1- public void keepLeaves () filter all nodes but leaves nodes. For example keepLeaves() applied to "<DIV>In The Middle<DIV>Hello World!</DIV></DIV>" gives as result the removal of top node (containing "In The Middle<DIV>Hello World!</DIV>") and the only element in the list will be the leaf node (containing "Hello World!"). 2- public void keepTopLevel () filter all nodes but nodes of the top level. For example keepTopLevel() applied to "<DIV>In The Middle<DIV>Hello World!</DIV></DIV>" gives as result the removal of leaf node (containing "Hello World!") and the only element in the list will be the top node (containing "In The Middle<DIV>Hello World!</DIV>"). ---------------------------------------------------------------------------- --------- package org.htmlparser.util; Class ParserUtils I suggest to add methods doing trim and split operations giving a string input variable as parameter. The trim and split operations have various methods that consider as trimming and splitting delimiters: spaces and tabs, digits, tags, simple characters. The use of this function could proficencly refine the text inside or outside tags. ---------------------------------------------------------------------------- --------- Another interesting improvement is to add the following method: public static Parser createParserParsingAnInputString (String input) throws ParserException, UnsupportedEncodingException This method will create a Parser Object from an input string. The input string is NOT the href of file or url in input but it is the stream itself. For example a significative input string could be: "<DIV>Hello World!</DIV>". This method could be added in Parser class or in both classes Parser and ParserUtils classes. Hope you like, Alberto Nacher User ID: 892989 Login Name (User Name): anul |