A weird problem happened when parsing a html page using HTMLParser
I was parsing a web page usi开发者_如何转开发ng HTMLParser in Java, I met a weird problem when using class HasAttributeFilter
.
The element I wanna parse in the page is <span style="vertical-align: middle;"></span>
, so the expression should be HasAttributeFilter filter = new HasAttributeFilter("style", "vertical-align: middle;");
, right? Yeah, I used this exp, but it DIDN'T WORK! BUT I am sure there IS the node in the page
After that, I applied some other exp, such as HasAttributeFilter filter = new HasAttributeFilter("class", "singlecolumnminwidth");
to the same page, and also, the node is there, something weird happened, this expression WORKED!
Has anyone met this problem before? Help me ... Thanks in advance!
The page's link.
what do you get if you fetch the value of this attribue and print it out to the screen?
do you maybe have to escape some chars like space or minus? think it could have problems with the space in between
does vertical-align:middle; work? or maybe test if its the minus causing an error
精彩评论