jsoup quotes and spaces

I am trying to pick, using Jsoup, the paragraph inside the following HTML snippet:

<div class="abc ">
<p class="de">Very short paragraph.</p>
</div>

For that, I am using the following Java code snippet:

Elements divs = document.select("div[class=abc ]");
for (Element div : divs) {
  Log.v("iwashere", String.format("div[class=abc ]"));
  Elements ppp = document.select("p[class=de]");                   
  for (Element p : ppp) {
    Log.v("iwashere", p.text());
    break;                                                
  } 
}

The problem is that, for some reason, Jsoup doesn't seem to pick up the "div[class=abc ]" (the Log.v("iwashere") never shows up in the log.

At first, I thought that the trailing space may be a problem, so I also tried

Elements divs = document.select("div[class=abc]");

but that didn't help either.

What could be the problem in the above code?

5
задан Regex Rookie 7 April 2011 в 04:43
поделиться