Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title empty when parsing with TagSoup #15

Open
GoogleCodeExporter opened this issue May 25, 2015 · 0 comments
Open

Title empty when parsing with TagSoup #15

GoogleCodeExporter opened this issue May 25, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

I am using TagSoup for parsing HTML documents:

URL url = new URL("http://www.bbc.co.uk/news/uk-12038847")
Parser parser = new Parser();
BoilerpipeHTMLContentHandler handler = new BoilerpipeHTMLContentHandler();
parser.setContentHandler(handler);  
System.out.println("T: " + handler.toTextDocument().getTitle());
InputSource is = HTMLFetcher.fetch(url).toInputSource();
parser.parse(is);


What is the expected output? What do you see instead?

With the example document from the BBC you should get
"BBC News - Snow disrupts travel across northern Europe"
Instead it is null.


What version of the product are you using? On what operating system?

Trunk

Please provide any additional information below.

The problem can be fixed if I change 
BoilerpipeHTMLContentHandler.characters method
and move flushBlock() invocation from the begging of the method to its end (see 
attached patch). Since I have no idea why this helps, I am not sure if that is 
not braking other things.



Original issue reported on code.google.com by zzy...@gmail.com on 20 Dec 2010 at 8:02

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant